Fixes errno value for opens without O_CREATE
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 23 Sep 2014 21:46:35 +0000 (14:46 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 23 Sep 2014 21:47:46 +0000 (14:47 -0700)
Return the error value of the path lookup, which could be due to a missing
directory, too many loops, etc.

kern/src/vfs.c

index 5dcc314..b3945ea 100644 (file)
@@ -1392,7 +1392,7 @@ struct file *do_file_open(char *path, int flags, int mode)
                goto open_the_file;
        }
        if (!(flags & O_CREAT)) {
-               set_errno(ENOENT);
+               set_errno(-error);
                goto out_path_only;
        }
        /* So it didn't already exist, release the path from the previous lookup,