This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Rich Felker <dalias at aerifal dot cx>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Tue, 08 Oct 2013 12:01:39 -0400
- Subject: Re: [PATCH][BZ #13724] Do not segfault in pthread_setname_np (x, NULL)
- Authentication-results: sourceware.org; auth=none
- References: <20131003122009 dot GA8891 at domone dot podge> <524DCA52 dot 2030609 at redhat dot com> <20131007141928 dot GV20515 at brightrain dot aerifal dot cx>
On 10/07/2013 10:19 AM, Rich Felker wrote:
> If you're going to check for NULL pointer arguments where you have
> not entered into a contract to accept and interpret them, do it
> with an assert, not a conditional error return. This way the bugs
> in the caller will be immediately detected and can be fixed, and
> it makes it easy to disable the overhead in production builds. I
> question the value of the assert except as documentation however;
> a segfault from dereferencing the NULL pointer is just as
> effective for debugging.
Should we have an assert there then to document the contract and provide
a more meaningful error message like a backtrace?