X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fmknod.c;h=ee2d1ffa108add1f42b58df9535291fd5fbc6cc1;hb=e2249b7ce1dd0a2f8f110e0e47aca397185a6373;hp=46a183924252c79d22f7f65f8aa9106e5d4252b1;hpb=2d9953097b6d3b71122d444a4550047e97aee009;p=libguestfs.git diff --git a/daemon/mknod.c b/daemon/mknod.c index 46a1839..ee2d1ff 100644 --- a/daemon/mknod.c +++ b/daemon/mknod.c @@ -26,7 +26,7 @@ #include #include -#include "../src/guestfs_protocol.h" +#include "guestfs_protocol.h" #include "daemon.h" #include "actions.h" #include "optgroups.h" @@ -51,12 +51,17 @@ 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; if (r == -1) { - reply_with_perror ("mknod: %s", path); + reply_with_perror ("%s", path); return -1; }