rearrange for kirk
[unix-history] / usr / src / sys / kern / vfs_vnops.c
index c7f0eab..67693a4 100644 (file)
@@ -1,4 +1,4 @@
-/*     vfs_vnops.c     4.18    82/01/19        */
+/*     vfs_vnops.c     4.22    82/02/27        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -13,6 +13,7 @@
 #include "../h/mount.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../h/mount.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
+#include "../h/proc.h"
 
 /*
  * Convert a user supplied file descriptor into a pointer
 
 /*
  * Convert a user supplied file descriptor into a pointer
@@ -42,8 +43,10 @@ getf(f)
  * Decrement reference count on the inode following
  * removal to the referencing file structure.
  * Call device handler on last close.
  * Decrement reference count on the inode following
  * removal to the referencing file structure.
  * Call device handler on last close.
+ * Nouser indicates that the user isn't available to present
+ * errors to.
  */
  */
-closef(fp)
+closef(fp, nouser)
        register struct file *fp;
 {
        register struct inode *ip;
        register struct file *fp;
 {
        register struct inode *ip;
@@ -60,7 +63,10 @@ closef(fp)
        }
        flag = fp->f_flag;
        if (flag & FSOCKET) {
        }
        flag = fp->f_flag;
        if (flag & FSOCKET) {
-               soclose(fp->f_socket, u.u_procp->p_flag&SWEXIT);
+               u.u_error = 0;                  /* XXX */
+               soclose(fp->f_socket, nouser);
+               if (nouser == 0 && u.u_error)
+                       return;
                fp->f_socket = 0;
                fp->f_count = 0;
                return;
                fp->f_socket = 0;
                fp->f_count = 0;
                return;
@@ -177,7 +183,9 @@ access(ip, mode)
                return (0);
        if (u.u_uid != ip->i_uid) {
                m >>= 3;
                return (0);
        if (u.u_uid != ip->i_uid) {
                m >>= 3;
-               if (u.u_gid != ip->i_gid)
+               if (ip->i_gid >= NGRPS ||
+                   (u.u_grps[ip->i_gid/(sizeof(int)*8)] &
+                    (1 << ip->i_gid%(sizeof(int)*8)) == 0))
                        m >>= 3;
        }
        if ((ip->i_mode&m) != 0)
                        m >>= 3;
        }
        if ((ip->i_mode&m) != 0)
@@ -195,11 +203,12 @@ access(ip, mode)
  * return inode pointer.
  */
 struct inode *
  * return inode pointer.
  */
 struct inode *
-owner()
+owner(follow)
+       int follow;
 {
        register struct inode *ip;
 
 {
        register struct inode *ip;
 
-       ip = namei(uchar, 0);
+       ip = namei(uchar, 0, follow);
        if (ip == NULL)
                return (NULL);
        if (u.u_uid == ip->i_uid)
        if (ip == NULL)
                return (NULL);
        if (u.u_uid == ip->i_uid)