]> git.seodisparate.com - SimpleArchiver/commitdiff
Force empty-dir perms only on "force-empty" flag
authorStephen Seo <seo.disparate@gmail.com>
Wed, 12 Feb 2025 10:05:46 +0000 (19:05 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 12 Feb 2025 10:05:46 +0000 (19:05 +0900)
Previous behavior used the `--force-dir-permissions <octals>` flag to
set the archive-creation-empty-dirs permissions.

This commit changes this to check `--force-empty-dir-permissions
<octals>` instead.

Only applicable to file format versions 2 and 3.

src/archiver.c

index 84bb079331cd4aad4494ce7ab9f10c3fcb34cfb9..c6f972f58b03bfb94ccea3fb790141aaaa5b06f0 100644 (file)
@@ -1937,8 +1937,8 @@ int internal_write_dir_entries_v2_v3(void *data, void *ud) {
 
   uint8_t u8 = 0;
 
-  if (state && state->parsed->flags & 0x2000) {
-    u8 = state->parsed->dir_permissions & 0xFF;
+  if (state && state->parsed->flags & 0x10000) {
+    u8 = state->parsed->empty_dir_permissions & 0xFF;
   } else {
     if ((stat_buf.st_mode & S_IRUSR) != 0) {
       u8 |= 1;
@@ -1974,8 +1974,8 @@ int internal_write_dir_entries_v2_v3(void *data, void *ud) {
   }
 
   u8 = 0;
-  if (state && state->parsed->flags & 0x2000) {
-    u8 = (state->parsed->dir_permissions & 0x100) >> 8;
+  if (state && state->parsed->flags & 0x10000) {
+    u8 = (state->parsed->empty_dir_permissions & 0x100) >> 8;
   } else {
     if ((stat_buf.st_mode & S_IXOTH) != 0) {
       u8 |= 1;