strdup(NULL) supposed to create SIGSEGV?
Giorgos Keramidas
keramida at ceid.upatras.gr
Wed Apr 23 22:12:36 UTC 2008
On Wed, 23 Apr 2008 09:06:44 -0700 (PDT), Simun Mikecin <numisemis at yahoo.com> wrote:
>>If you're going to quote documents to support your ideas, it's probably
>>better to read them first.
>
> My apologies. My fingers were faster than my mind. But this made me
> read it the way I should have done in the first place. And I see that
> it says:
>
> "A null pointer is returned if the new string cannot be created."
>
> Does that also mean that a null pointer is returned if the input is a
> NULL pointer (cause in that case new string could not be created)?
No. It means that if the input is *valid* but the is a problem with
completing the operation of strdup(validstring), then an error is
returned to let you know something bad is going on.
More information about the freebsd-hackers
mailing list