Break out of open without checking 9ns if EEXIST
authorKevin Klues <klueska@cs.berkeley.edu>
Thu, 12 Jun 2014 19:38:16 +0000 (12:38 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 12 Jun 2014 19:38:58 +0000 (12:38 -0700)
kern/src/syscall.c

index 73e42c0..ff9b064 100644 (file)
@@ -1142,6 +1142,8 @@ static intreg_t sys_open(struct proc *p, const char *path, size_t path_l,
                if (fd < 0)
                        warn("File insertion failed");
        } else {
+               if (get_errno() == EEXIST)
+                       return -1;
                unset_errno();  /* Go can't handle extra errnos */
                fd = sysopen(t_path, oflag);
                /* successful lookup with CREATE and EXCL is an error */