daemon: Use gnulib futimens module.
[libguestfs.git] / daemon / dir.c
index 1ca6286..a5076b1 100644 (file)
@@ -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)
 {