X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fdir.c;h=bc54d518a1fb855c7c5c748c6c4582a563f05d18;hp=205139b8f0594528c91f73fccfcf910461e42565;hb=641ccab6c3b17f1c94676eab99e8baa9cddf5a0b;hpb=e9c37113104c1cfb234535adc9b52ad3880a41ce diff --git a/daemon/dir.c b/daemon/dir.c index 205139b..bc54d51 100644 --- a/daemon/dir.c +++ b/daemon/dir.c @@ -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) {