access / nami misfeature

utzoo!decvax!ucbvax!ihnss!wheps!zeppo!harpo!floyd!cmcl2!salkind utzoo!decvax!ucbvax!ihnss!wheps!zeppo!harpo!floyd!cmcl2!salkind
Tue Mar 30 16:12:06 AEST 1982


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



More information about the Comp.bugs.4bsd.ucb-fixes mailing list