]> git.saurik.com Git - cydia.git/blobdiff - MobileCydia.mm
Six years in the making: Cydia now has suspension!
[cydia.git] / MobileCydia.mm
index 86a36ff529a9d719bb8d07bf40ea0498db691cfe..83783e36387075fc43fecb4aac521c0b2315931a 100644 (file)
@@ -247,11 +247,13 @@ struct Root {
         root_ = true;
         _trace();
         _assert(setreuid(real ? 0 : 501, 0) != -1);
+        _assert(setregid(real ? 0 : 501, 0) != -1);
     }
 
     ~Root() {
         root_ = false;
         _trace();
+        _assert(setregid(501, 501) != -1);
         _assert(setreuid(501, 501) != -1);
     }
 
@@ -9059,7 +9061,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
         }
     }
 
-    CydiaWriteSources();
+    _root(true) CydiaWriteSources();
 }
 
 // Navigation controller for the queuing badge.
@@ -9509,6 +9511,21 @@ _end
     return true;
 }
 
+- (void) suspendReturningToLastApp:(BOOL)returning {
+    if ([self isSafeToSuspend])
+        [super suspendReturningToLastApp:returning];
+}
+
+- (void) suspend {
+    if ([self isSafeToSuspend])
+        [super suspend];
+}
+
+- (void) applicationSuspend {
+    if ([self isSafeToSuspend])
+        [super applicationSuspend];
+}
+
 - (void) applicationSuspend:(__GSEvent *)event {
     if ([self isSafeToSuspend])
         [super applicationSuspend:event];
@@ -10402,7 +10419,7 @@ int main(int argc, char *argv[]) {
     } broken = nil;
     /* }}} */
 
-    CydiaWriteSources();
+    _root(true) CydiaWriteSources();
 
     _trace();
     _root(true) MetaFile_.Open("/var/lib/cydia/metadata.cb0");