summaryrefslogtreecommitdiffstats
path: root/daemon/mknod.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/mknod.c')
-rw-r--r--daemon/mknod.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/daemon/mknod.c b/daemon/mknod.c
index 50865a62..2458a851 100644
--- a/daemon/mknod.c
+++ b/daemon/mknod.c
@@ -51,6 +51,11 @@ do_mknod (int mode, int devmajor, int devminor, const char *path)
#ifdef HAVE_MKNOD
int r;
+ if (mode < 0) {
+ reply_with_error ("%s: mode is negative", path);
+ return -1;
+ }
+
CHROOT_IN;
r = mknod (path, mode, makedev (devmajor, devminor));
CHROOT_OUT;