[comp.sources.bugs] unfsd - user-level NFS server patch #1

shand@cad.jmrc.eecs.unsw.oz (Mark Shand) (07/22/88)

Problem:

The user-level NFS server I posted to the net in May, incorrectly
handles stat calls on non-existent files.

Repeat-by:

ls -l /x/y/z

where /x/y/z is a path name in a file system server by unfsd and the path
is valid in all but the last component.  ls should complain that the file
does not exist, but instead reports some plainly absurd stats for the file.

FIX:

Modify fh.c as follows.
-- Mark Shand (shand@cad.unsw.oz.AU)


*** fh.c.orig	Fri Jul 22 14:12:15 1988
--- fh.c	Fri Jul 22 14:08:45 1988
***************
*** 753,759 ****
--- 753,762 ----
  	if (sbp == NULL)
  		sbp = &sbuf;
  	if (lstat(path, sbp) < 0)
+ 	{
  		*status = (nfsstat) errno;
+ 		return 0;
+ 	}
  		
  	if ((sbp->st_mode & S_IFMT) == S_IFDIR && strcmp(path, "/") != 0)
  	{