summaryrefslogtreecommitdiff
path: root/postinst.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2014-06-13 01:31:54 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2014-06-13 01:31:54 -0700
commitb132a9721b0c0bc21158e5d33445e0bf700f97b0 (patch)
tree536407c6bdf11e2a235197b8b887cc590459d9bd /postinst.mm
parentcd701a7b2beb7bf3e60047c65c8445df12e30d09 (diff)
Fix permissions of _.* containers on new stashes.
Diffstat (limited to 'postinst.mm')
-rw-r--r--postinst.mm29
1 files changed, 29 insertions, 0 deletions
diff --git a/postinst.mm b/postinst.mm
index a326911..405b317 100644
--- a/postinst.mm
+++ b/postinst.mm
@@ -24,6 +24,33 @@ void Finish(const char *finish) {
fclose(fout);
}
+static void FixPermissions() {
+ DIR *stash(opendir("/var/stash"));
+ if (stash == NULL)
+ return;
+
+ while (dirent *entry = readdir(stash)) {
+ const char *folder(entry->d_name);
+ if (strlen(folder) != 8)
+ continue;
+ if (strncmp(folder, "_.", 2) != 0)
+ continue;
+
+ char path[1024];
+ sprintf(path, "/var/stash/%s", folder);
+
+ struct stat stat;
+ if (lstat(path, &stat) == -1)
+ continue;
+ if (!S_ISDIR(stat.st_mode))
+ continue;
+
+ chmod(path, 0755);
+ }
+
+ closedir(stash);
+}
+
#define APPLICATIONS "/Applications"
static bool FixApplications() {
char target[1024];
@@ -126,6 +153,8 @@ int main(int argc, const char *argv[]) {
CydiaWriteSources();
+ FixPermissions();
+
if (FixApplications())
Finish("restart");