X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fdir.c;h=a5076b193fe13ff8f27f4199bdfc5ebd205a1294;hp=1ca62868ea9a091a0ab05f27787e8959e2a7ef37;hb=b3035e8d7c04a71d9a54ab7e52bc9e169ecf0b47;hpb=1f0810eb3a98cbfd347af59b6b9bc624ddff6028 diff --git a/daemon/dir.c b/daemon/dir.c index 1ca6286..a5076b1 100644 --- a/daemon/dir.c +++ b/daemon/dir.c @@ -56,7 +56,7 @@ do_rm_rf (const char *path) int r; char *buf, *err; - if (strcmp (path, "/") == 0) { + if (STREQ (path, "/")) { reply_with_error ("rm -rf: cannot remove root directory"); return -1; } @@ -99,6 +99,23 @@ do_mkdir (const char *path) return 0; } +int +do_mkdir_mode (const char *path, int mode) +{ + int r; + + CHROOT_IN; + r = mkdir (path, mode); + CHROOT_OUT; + + if (r == -1) { + reply_with_perror ("mkdir_mode: %s", path); + return -1; + } + + return 0; +} + static int recursive_mkdir (const char *path) {