Made a call which was to sleep() use tsleep() instead.
[unix-history] / sys / kern / vfs_lookup.c
index ce20836..ccbdd33 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) UNIX System Laboratories, Inc.  All or some portions
+ * of this file are derived from material licensed to the
+ * University of California by American Telephone and Telegraph Co.
+ * or UNIX System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ */
 /*
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  * All rights reserved.
 /*
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  * All rights reserved.
@@ -31,7 +38,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)vfs_lookup.c  7.32 (Berkeley) 5/21/91
  * SUCH DAMAGE.
  *
  *     from: @(#)vfs_lookup.c  7.32 (Berkeley) 5/21/91
- *     $Id: vfs_lookup.c,v 1.4 1993/11/07 21:44:48 wollman Exp $
+ *     $Id: vfs_lookup.c,v 1.8 1994/05/26 04:40:05 ache Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -99,6 +106,13 @@ namei(ndp, p)
        else
                error = copyinstr(ndp->ni_dirp, ndp->ni_pnbuf,
                            MAXPATHLEN, (u_int *)&ndp->ni_pathlen);
        else
                error = copyinstr(ndp->ni_dirp, ndp->ni_pnbuf,
                            MAXPATHLEN, (u_int *)&ndp->ni_pathlen);
+#if 0
+       /*
+        * Don't allow empty pathname.
+        */
+       if (!error && *ndp->ni_pnbuf == '\0')
+               error = ENOENT;
+#endif
        if (error) {
                free(ndp->ni_pnbuf, M_NAMEI);
                ndp->ni_vp = NULL;
        if (error) {
                free(ndp->ni_pnbuf, M_NAMEI);
                ndp->ni_vp = NULL;
@@ -277,10 +291,10 @@ dirloop:
         * responsibility for freeing the pathname buffer.
         */
        ndp->ni_hash = 0;
         * responsibility for freeing the pathname buffer.
         */
        ndp->ni_hash = 0;
-       for (cp = ndp->ni_ptr; *cp != 0 && *cp != '/'; cp++)
+       for (cp = ndp->ni_ptr; *cp != '\0' && *cp != '/'; cp++)
                ndp->ni_hash += (unsigned char)*cp;
        ndp->ni_namelen = cp - ndp->ni_ptr;
                ndp->ni_hash += (unsigned char)*cp;
        ndp->ni_namelen = cp - ndp->ni_ptr;
-       if (ndp->ni_namelen >= NAME_MAX) {
+       if (ndp->ni_namelen > NAME_MAX) {
                error = ENAMETOOLONG;
                goto bad;
        }
                error = ENAMETOOLONG;
                goto bad;
        }
@@ -360,7 +374,7 @@ dirloop:
                printf("not found\n");
 #endif
                if (flag == LOOKUP || flag == DELETE ||
                printf("not found\n");
 #endif
                if (flag == LOOKUP || flag == DELETE ||
-                   error != ENOENT || *cp != 0)
+                   error != ENOENT || *cp != '\0')
                        goto bad;
                /*
                 * If creating and at end of pathname, then can consider
                        goto bad;
                /*
                 * If creating and at end of pathname, then can consider