Nullpath in system calls considered harmful?

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Feb 4 18:01:07 AEST 1989


In article <88368 at sun.uucp> lm at sun.UUCP (Larry McVoy) writes:
>	A question for oldtimers: is there any good reason that null paths
>    (ie, open("", flags)) should NOT be considered an error.  If you don't
>    already know that many kernels translate "" into "." you probably
>    can't answer this question.  POSIX wants "" to be an error.

We've discussed this before (Dennis even chipped in).
>From one point of view "" is a natural way to designate the CWD.
However, it can lead to unpleasant surprises in usages such as:
	strcat( strcat( strcat( strcpy( cmd, "rm " ), dir ), "/" ), file );
	system( cmd );
Also, "" is often the result of program bugs and having it be an
illegal pathname is safer than letting the operation occur.



More information about the Comp.unix.wizards mailing list