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

Re: screen says "Bad tty" if /dev/console is a symlink

On Sun, Jan 27, 2013 at 02:25:56PM +0100, Guillem Jover wrote:
> > +  char real[MAX_PATH];
> I guess you meant PATH_MAX here, in any case POSIX does not guarantee
> MAX variables to be defined, it would be better to use the POSIX.1-2008
> variant of realpath(3) that allocates when passed a NULL (by checking
> if it's available at configure time).

Really, I'd say realpath() should call abort() immediately if called with a
non-NULL argument -- it's better to catch buffer overflows immediately
rather than to allow them to linger.

No modern system implements PATH_MAX.  On Linux, it's hardcoded to a random
value of 4096 for compat reasons, so is pathconf(_PC_PATH_MAX), but I really
wish both went the Hurd way and swat away dumb code before we get a DSA.


Reply to: