don't allow more than LINK_MAX links
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 17 Feb 1989 06:23:38 +0000 (22:23 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 17 Feb 1989 06:23:38 +0000 (22:23 -0800)
SCCS-vsn: sys/kern/vfs_syscalls.c 7.5
SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 7.5
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.5
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 7.5
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.5

usr/src/sys/kern/vfs_syscalls.c
usr/src/sys/ufs/ffs/ffs_vnops.c
usr/src/sys/ufs/ffs/ufs_vnops.c
usr/src/sys/ufs/lfs/lfs_vnops.c
usr/src/sys/ufs/ufs/ufs_vnops.c

index 7485eee..1e507de 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vfs_syscalls.c      7.4 (Berkeley) %G%
+ *     @(#)vfs_syscalls.c      7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -264,6 +264,11 @@ link()
                iput(ip);
                return;
        }
                iput(ip);
                return;
        }
+       if (ip->i_nlink == LINK_MAX - 1) {
+               u.u_error = EMLINK;
+               iput(ip);
+               return;
+       }
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
index 7566bc5..0b53693 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_vnops.c 7.4 (Berkeley) %G%
+ *     @(#)ffs_vnops.c 7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -264,6 +264,11 @@ link()
                iput(ip);
                return;
        }
                iput(ip);
                return;
        }
+       if (ip->i_nlink == LINK_MAX - 1) {
+               u.u_error = EMLINK;
+               iput(ip);
+               return;
+       }
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
index 016a175..337aa7f 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_vnops.c 7.4 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -264,6 +264,11 @@ link()
                iput(ip);
                return;
        }
                iput(ip);
                return;
        }
+       if (ip->i_nlink == LINK_MAX - 1) {
+               u.u_error = EMLINK;
+               iput(ip);
+               return;
+       }
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
index bc4354f..5cdd1e7 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_vnops.c 7.4 (Berkeley) %G%
+ *     @(#)lfs_vnops.c 7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -264,6 +264,11 @@ link()
                iput(ip);
                return;
        }
                iput(ip);
                return;
        }
+       if (ip->i_nlink == LINK_MAX - 1) {
+               u.u_error = EMLINK;
+               iput(ip);
+               return;
+       }
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
index 016a175..337aa7f 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_vnops.c 7.4 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.5 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -264,6 +264,11 @@ link()
                iput(ip);
                return;
        }
                iput(ip);
                return;
        }
+       if (ip->i_nlink == LINK_MAX - 1) {
+               u.u_error = EMLINK;
+               iput(ip);
+               return;
+       }
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);
        ip->i_nlink++;
        ip->i_flag |= ICHG;
        iupdat(ip, &time, &time, 1);