summaryrefslogtreecommitdiff
path: root/postinst.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2014-10-25 05:24:11 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2014-10-25 05:48:34 -0700
commit82e370b360798dcc8cdf41f68744788e503bb8a2 (patch)
tree75e34f1a351b40ab211b363701a7ab47499e8d06 /postinst.mm
parent2eef6631860e965f33d3b0293a8bceea6effd87b (diff)
Carefully set NSFileProtectionNone inside of /var.
Diffstat (limited to 'postinst.mm')
-rw-r--r--postinst.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/postinst.mm b/postinst.mm
index 405b317..bbef4c8 100644
--- a/postinst.mm
+++ b/postinst.mm
@@ -24,6 +24,17 @@ void Finish(const char *finish) {
fclose(fout);
}
+static bool FixProtections() {
+ for (const char *path : (const char *[]) {"/var/lib", "/var/cache", "/var/stash"}) {
+ mkdir(path, 0755);
+ if (system([[NSString stringWithFormat:@"/usr/libexec/cydia/setnsfpn %s", path] UTF8String]) != 0) {
+ fprintf(stderr, "failed to setnsfpn %s\n", path);
+ return false;
+ }
+ }
+ return true;
+}
+
static void FixPermissions() {
DIR *stash(opendir("/var/stash"));
if (stash == NULL)
@@ -125,6 +136,10 @@ int main(int argc, const char *argv[]) {
NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
+ if (kCFCoreFoundationVersionNumber >= 1000)
+ if (!FixProtections())
+ return 1;
+
size_t size;
sysctlbyname("kern.osversion", NULL, &size, NULL, 0);
char *osversion = new char[size];