action: chmod: fix mode setting if octal value specified for mode
The set code incorrectly did (st_mode & ~S_IFMT) | mode, which is the
exact inverse of what it should have been, i.e. (st_mode & S_IFMT) | mode
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
diff --git a/squashfs-tools/action.c b/squashfs-tools/action.c
index 4e64a33..b70cd26 100644
--- a/squashfs-tools/action.c
+++ b/squashfs-tools/action.c
@@ -1432,7 +1432,7 @@
switch(mode_data->operation) {
case ACTION_MODE_OCT:
- st_mode = (st_mode & ~S_IFMT) | mode;
+ st_mode = (st_mode & S_IFMT) | mode;
break;
case ACTION_MODE_SET:
st_mode = (st_mode & ~mode_data->mask) | mode;