summarylogtreecommitdiffstats
path: root/permissions-fix.patch
blob: 874e4224ff092cc94a568b462aeeb7093ecc838a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff -ur trrntzip.orig/src/trrntzip.c trrntzip/src/trrntzip.c
--- trrntzip.orig/src/trrntzip.c	2005-05-02 06:38:40.000000000 -0700
+++ trrntzip/src/trrntzip.c	2018-10-18 15:28:39.563261422 -0700
@@ -716,7 +716,7 @@
   
     if (dirp)
     {
-      // First set all the files to read-only. This is so we can skip
+      // First set the sticky bit on all files. This is so we can skip
       // our new zipfiles if they are returned by readdir() a second time.
       while (direntp = readdir (dirp))
       {
@@ -732,7 +732,7 @@
   
           if (strstr (szTmpBuf, ".zip\0"))
           {
-            chmod (direntp->d_name, S_IRUSR);
+            chmod (direntp->d_name, istat.st_mode | S_ISVTX);
           }
         }
         // Zip file is actually a dir
@@ -780,9 +780,9 @@
           sprintf (szTmpBuf, "%s", direntp->d_name);
           strlwr (szTmpBuf);
   
-          if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
+          if (strstr (szTmpBuf, ".zip\0") && (istat.st_mode & S_ISVTX))
           {            
-            chmod (direntp->d_name, S_IWUSR);
+            chmod (direntp->d_name, istat.st_mode & ~S_ISVTX);
             mig.cEncounteredZips++;
   
             if (!mig.fProcessLog)