From: Alan Cox Date: Fri, 30 Jan 2015 00:26:24 +0000 (+0000) Subject: link/mkdir: error link counter overrun X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5fd774821e1f34df01be7a72eb6482bba5bb0331;p=FUZIX.git link/mkdir: error link counter overrun --- diff --git a/Kernel/syscall_fs2.c b/Kernel/syscall_fs2.c index aacfde33..5357fa68 100644 --- a/Kernel/syscall_fs2.c +++ b/Kernel/syscall_fs2.c @@ -551,6 +551,11 @@ arg_t _link(void) if (getmode(ino) == F_DIR && esuper()) goto nogood; + if (ino->c_node.i_nlink == 0xFFFF) { + udata.u_error = EMLINK; + goto nogood; + } + /* Make sure file2 doesn't exist, and get its parent */ if ((ino2 = n_open(name2, &parent2)) != NULL) { i_deref(ino2); diff --git a/Kernel/syscall_other.c b/Kernel/syscall_other.c index f41475d0..be2e54c6 100644 --- a/Kernel/syscall_other.c +++ b/Kernel/syscall_other.c @@ -125,6 +125,11 @@ arg_t _mkdir(void) return (-1); } + if (parent->c_node.i_nlink == 0xFFFF) { + udata.u_error = EMLINK; + goto nogood2; + } + filename(name, fname); i_ref(parent); /* We need it again in a minute */