Improved checking, documentation of modes (RHBZ#582901, RHBZ#582929).
[libguestfs.git] / daemon / file.c
index dbdbbaa..7a0f8f9 100644 (file)
@@ -198,6 +198,11 @@ do_chmod (int mode, const char *path)
 {
   int r;
 
+  if (mode < 0) {
+    reply_with_error ("%s: mode is negative", path);
+    return -1;
+  }
+
   CHROOT_IN;
   r = chmod (path, mode);
   CHROOT_OUT;