X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fdir.c;h=383acd201739b17a3f1f6bea6fe7025b4e45e2ff;hp=205139b8f0594528c91f73fccfcf910461e42565;hb=37366ede50b78ff9159e080ebae08a822795452a;hpb=e9c37113104c1cfb234535adc9b52ad3880a41ce diff --git a/daemon/dir.c b/daemon/dir.c index 205139b..383acd2 100644 --- a/daemon/dir.c +++ b/daemon/dir.c @@ -25,7 +25,7 @@ #include #include -#include "../src/guestfs_protocol.h" +#include "guestfs_protocol.h" #include "daemon.h" #include "actions.h" @@ -104,6 +104,11 @@ do_mkdir_mode (const char *path, int mode) { int r; + if (mode < 0) { + reply_with_error ("%s: mode is negative", path); + return -1; + } + CHROOT_IN; r = mkdir (path, mode); CHROOT_OUT; @@ -185,28 +190,6 @@ do_mkdir_p (const char *path) return 0; } -int -do_is_dir (const char *path) -{ - int r; - struct stat buf; - - CHROOT_IN; - r = lstat (path, &buf); - CHROOT_OUT; - - if (r == -1) { - if (errno != ENOENT && errno != ENOTDIR) { - reply_with_perror ("stat: %s", path); - return -1; - } - else - return 0; /* Not a directory. */ - } - - return S_ISDIR (buf.st_mode); -} - char * do_mkdtemp (const char *template) {