summaryrefslogtreecommitdiffstats
path: root/daemon/file.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-04-17 13:33:14 +0100
committerRichard Jones <rjones@redhat.com>2010-04-17 13:36:26 +0100
commit61ab83d19009a8006dd73ebe16d22494b78be4d1 (patch)
treead14a0f005867ceea391da618792c59c9b395728 /daemon/file.c
parent42fc0e02b094ef3b19dae115276a0a33116af6d5 (diff)
downloadlibguestfs-61ab83d19009a8006dd73ebe16d22494b78be4d1.tar.gz
libguestfs-61ab83d19009a8006dd73ebe16d22494b78be4d1.tar.xz
libguestfs-61ab83d19009a8006dd73ebe16d22494b78be4d1.zip
Improved checking, documentation of modes (RHBZ#582901, RHBZ#582929).
chmod: Disallow negative mode, document mode affected by umask. mkdir-mode: Disallow negative mode, document that filesystems may interpret the mode in different ways. mknod: Disallow negative mode, document mode affected by umask. umask: Check the range of umask mask value carefully.
Diffstat (limited to 'daemon/file.c')
-rw-r--r--daemon/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/daemon/file.c b/daemon/file.c
index dbdbbaae..7a0f8f92 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -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;