Acmcl2.408
net.bugs.4bsd
utcsrgv!utzoo!decvax!ucbvax!ihnss!wheps!zeppo!harpo!floyd!cmcl2!salkind
Tue Mar 30 16:12:06 1982
access / nami misfeature
The system treats a reference to a null filename as a reference to the
root directory.  The following mini-program illustrates the problem.

char filename[15];

main()
{
       while (access(filename, 4) >= 0)
               sleep(15);
}

Access returns a non-negative value here, even though there is certainly
no filename with all nulls in it.  Therefore the program sleeps forever.

The fix is in nami().  Before the first call to iget(), add the lines

       else if (c == '\0') {
               u.u_error = ENOENT;
               return(NULL);
       }

                                               Lou Salkind
                                               cmcl2!salkind

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.