summaryrefslogtreecommitdiff
path: root/system/trrntzip/trrntzip_permission_fix.diff
diff options
context:
space:
mode:
Diffstat (limited to 'system/trrntzip/trrntzip_permission_fix.diff')
-rw-r--r--system/trrntzip/trrntzip_permission_fix.diff47
1 files changed, 47 insertions, 0 deletions
diff --git a/system/trrntzip/trrntzip_permission_fix.diff b/system/trrntzip/trrntzip_permission_fix.diff
new file mode 100644
index 0000000000..6e6f93929e
--- /dev/null
+++ b/system/trrntzip/trrntzip_permission_fix.diff
@@ -0,0 +1,47 @@
+diff -Nru trrntzip/src/trrntzip.c trrntzip_v2patched/src/trrntzip.c
+--- trrntzip/src/trrntzip.c 2005-05-02 10:38:40.000000000 -0300
++++ trrntzip_v2patched/src/trrntzip.c 2009-07-09 23:50:57.833279724 -0300
+@@ -732,7 +732,15 @@
+
+ if (strstr (szTmpBuf, ".zip\0"))
+ {
+- chmod (direntp->d_name, S_IRUSR);
++ //chmod (direntp->d_name, S_IRUSR);
++#ifndef S_ISVTX
++ // On windows we just set the file to read-only
++ chmod (direntp->d_name, S_IRUSR);
++#else
++ // On Unix systems we use the sticky bit
++ // We also retain all other flags
++ chmod (direntp->d_name, S_ISVTX | istat.st_mode);
++#endif
+ }
+ }
+ // Zip file is actually a dir
+@@ -780,9 +788,22 @@
+ sprintf (szTmpBuf, "%s", direntp->d_name);
+ strlwr (szTmpBuf);
+
+- if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
+- {
+- chmod (direntp->d_name, S_IWUSR);
++ //if (strstr (szTmpBuf, ".zip\0") && !(istat.st_mode & S_IWUSR))
++ //{
++ // chmod (direntp->d_name, S_IWUSR);
++ if (strstr (szTmpBuf, ".zip\0") &&
++
++#ifndef S_ISVTX
++ !(istat.st_mode & S_IWUSR))
++ {
++ // Remove the read only bit we set earlier on Windows systems
++ chmod (direntp->d_name, S_IWUSR);
++#else
++ istat.st_mode & S_ISVTX)
++ {
++ // Remove the sticky bit we set earlier on Unix systems
++ chmod (direntp->d_name, istat.st_mode - S_ISVTX);
++#endif
+ mig.cEncounteredZips++;
+
+ if (!mig.fProcessLog)
+