[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird PATH_MAX discussion in mplayer's list. (Fwd: [MPlayer-dev-eng]

From: Jeroen Dekkers
Subject: Re: weird PATH_MAX discussion in mplayer's list. (Fwd: [MPlayer-dev-eng] [PATCH] fix for unconditional use of PATH_MAX)
Date: Fri, 2 May 2003 12:39:45 +0200
User-agent: Mutt/1.5.3i

On Thu, May 01, 2003 at 05:33:58PM -0600, mike burrell wrote:
> Robert Millan ( said:
> > On Thu, May 01, 2003 at 12:23:32PM -0600, mike burrell wrote:
> > > 
> > > First of all, your patch is not good.  It invokes undefined behaviour on
> > > every platform without PATH_MAX that is not GNU.  Not good if you want to
> > > promote portability, methinks.
> > 
> > see the thread, i pasted a code example that supports systems with
> > specific limits but no PATH_MAX, using pathconf.
> The problem was with getcwd(NULL, 0);  Passing NULL as the first argument to
> getcwd() invokes undefined behaviour, even if the second argument is 0. 
> Which makes it a bit curious why GNU decided to have that exact usage as an
> extension....

The behaviour is unspecified instead of undefined. The rationale tells
you that on some implementations getcwd() uses malloc() if you pass a
NULL pointer. So it's not that strange that GNU uses it to implement
an extension.

Jeroen Dekkers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]