strdup(NULL) supposed to create SIGSEGV?

Dimitry Andric dimitry at andric.com
Wed Apr 23 07:21:14 UTC 2008


On 2008-04-23 07:40, Garrett Cooper wrote:
>      I made an oops in a program, which uncovered "feature" in strdup(2)
> that I wasn't aware of before. So I was wondering, is strdup(pointer = NULL)
> supposed to segfault should this just return NULL and set errno?

It could, in fact, tear up the fabric of the universe, or blow up your
machine, if it wanted. :)


More information about the freebsd-hackers mailing list