From: Alan Cox Date: Wed, 21 Feb 2018 20:40:49 +0000 (+0000) Subject: link: don't allow superuser to link to directories X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1f428df51dbc95474f6435be9fc3f5823368c428;p=FUZIX.git link: don't allow superuser to link to directories --- diff --git a/Kernel/syscall_fs3.c b/Kernel/syscall_fs3.c index c7c81417..b8404964 100644 --- a/Kernel/syscall_fs3.c +++ b/Kernel/syscall_fs3.c @@ -178,8 +178,10 @@ arg_t _link(void) if (!(ino = n_open(name1, NULLINOPTR))) return (-1); - if (getmode(ino) == MODE_R(F_DIR)) + if (getmode(ino) == MODE_R(F_DIR)) { + udata.u_error = EISDIR; goto nogood; + } if (ino->c_node.i_nlink == 0xFFFF) { udata.u_error = EMLINK;