]> git.seodisparate.com - SimpleArchiver/commitdiff
Force set dir permissions when specified
authorStephen Seo <seo.disparate@gmail.com>
Wed, 25 Dec 2024 03:46:27 +0000 (12:46 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 25 Dec 2024 03:46:45 +0000 (12:46 +0900)
The previous behavior refused to set `write` for `group` and `other`
when setting directory permissions.

This commit changes this so that when permissions are specified, then
the directory is `chmod`d after its creation.

src/helpers.c

index 4a10a0edf509af91e70100650924d59fdcdc8318..4d8d88c7f6507561a79b58340fb332071293c5eb 100644 (file)
@@ -260,6 +260,11 @@ int simple_archiver_helper_make_dirs_perms(const char *file_path,
         // Error.
         return 2;
       }
+      ret = chmod(dir, perms);
+      if (ret != 0) {
+        // Error.
+        return 5;
+      }
       if (geteuid() == 0 && chown(dir, uid, gid) != 0) {
         // Error.
         return 4;