X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fmknod.c;h=2458a8514f7c8b1188fa21a35f0b7f4f80b0486b;hp=adaeb80e6e797cb54fd43bf12a565d8a8d8559d5;hb=c3a68961859a617f7c574c528d0f8ac1fdbb53e1;hpb=84fc760439e82e6b3616abd0d1f9bd7d7eb01ec0 diff --git a/daemon/mknod.c b/daemon/mknod.c index adaeb80..2458a85 100644 --- a/daemon/mknod.c +++ b/daemon/mknod.c @@ -29,22 +29,46 @@ #include "../src/guestfs_protocol.h" #include "daemon.h" #include "actions.h" +#include "optgroups.h" + +#ifdef HAVE_MKNOD +int +optgroup_mknod_available (void) +{ + return 1; +} +#else +int +optgroup_mknod_available (void) +{ + return 0; +} +#endif int 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; } return 0; +#else + NOT_AVAILABLE (-1); +#endif } int