]> git.saurik.com Git - cydia.git/blobdiff - MobileCydia.mm
Use ProcessArguments to get argv[0] (for iOS 3.0).
[cydia.git] / MobileCydia.mm
index 8765b7dc38fdbb79b506aeb974b8bfe62182a3eb..86e6a6f26841a1b59e23ed5d984de79fdd038bac 100644 (file)
@@ -4089,11 +4089,17 @@ class CydiaLogCleaner :
 
     delock_ = nil;
 
+    pkgPackageManager::OrderResult result(manager_->DoInstall(statusfd_));
+
     NSString *oextended(@"/var/lib/apt/extended_states");
     NSString *nextended(Cache("extended_states"));
-    pkgPackageManager::OrderResult result(manager_->DoInstall(statusfd_));
-    system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/mv -f %@ %@", nextended, oextended] UTF8String]);
-    system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/chown 0:0 %@", oextended] UTF8String]);
+
+    struct stat info;
+    if (stat([nextended UTF8String], &info) != -1 && (info.st_mode & S_IFMT) == S_IFREG) {
+        system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/mv -f %@ %@", nextended, oextended] UTF8String]);
+        system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/chown 0:0 %@", oextended] UTF8String]);
+    }
+
     unlink([nextended UTF8String]);
     symlink([oextended UTF8String], [nextended UTF8String]);
 
@@ -9344,15 +9350,7 @@ _end
             @synchronized (self) {
                 for (Package *broken in (id) broken_) {
                     [broken remove];
-                    NSString *id = [broken id];
-
-                    system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/rm -f"
-                        " /var/lib/dpkg/info/%@.prerm"
-                        " /var/lib/dpkg/info/%@.postrm"
-                        " /var/lib/dpkg/info/%@.preinst"
-                        " /var/lib/dpkg/info/%@.postinst"
-                        " /var/lib/dpkg/info/%@.extrainst_"
-                    , id, id, id, id, id] UTF8String]);
+                    system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /usr/libexec/cydia/fixhalf.sh %@", [broken id]] UTF8String]);
                 }
 
                 [self resolve];