Re: Fwd: strdup(NULL) supposed to create SIGSEGV?

2008-04-24 Thread Robert Watson
On Wed, 23 Apr 2008, Bakul Shah wrote: The *exception* is where a function is explicitly prepared to handle NULLs. One must read its man page carefully and if it doesn't say anything about how NULLs in place of ptrs are handled, one must not pass in NULLs! While I recognize there are some us

Re: Fwd: strdup(NULL) supposed to create SIGSEGV?

2008-04-23 Thread Bakul Shah
On Wed, 23 Apr 2008 11:03:10 BST Robert Watson <[EMAIL PROTECTED]> wrote: > On Wed, 23 Apr 2008, Garrett Cooper wrote: > > Of course I did some more research after you guys gave me some replies and > > realized I'm not the first person to bumble across this fact, but I haven't > > found FreeBSD o

Re: Fwd: strdup(NULL) supposed to create SIGSEGV?

2008-04-23 Thread Kostik Belousov
On Wed, Apr 23, 2008 at 02:19:53AM -0700, Garrett Cooper wrote: > On Wed, Apr 23, 2008 at 1:30 AM, Bernard van Gastel <[EMAIL PROTECTED]> > wrote: > > > > > Op 23 apr 2008, om 08:50 heeft Mike Meyer het volgende geschreven: > > > > > On Tue, 22 Apr 2008 22:40:21 -0700 > > > "Garrett Cooper" <[EMAI

Re: Fwd: strdup(NULL) supposed to create SIGSEGV?

2008-04-23 Thread Robert Watson
On Wed, 23 Apr 2008, Garrett Cooper wrote: But strdup uses malloc, which is a system call (from the strdup manual: If insufficient memory is available, NULL is returned and errno is set to ENOMEM.) FYI, malloc(3) is actually a library call, and while it obviously does invoke system calls (mm

Fwd: strdup(NULL) supposed to create SIGSEGV?

2008-04-23 Thread Garrett Cooper
On Wed, Apr 23, 2008 at 1:30 AM, Bernard van Gastel <[EMAIL PROTECTED]> wrote: > > Op 23 apr 2008, om 08:50 heeft Mike Meyer het volgende geschreven: > > > On Tue, 22 Apr 2008 22:40:21 -0700 > > "Garrett Cooper" <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > >I made an oops in a program, whic