]> git.saurik.com Git - cydia.git/commitdiff
Don't inject sources.list if cydia.list is linked.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 15:25:46 +0000 (08:25 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 15:25:46 +0000 (08:25 -0700)
MobileCydia.mm

index a636eeb5ad23a10b7089821e9a32941e25bba2ab..75d28421a7ac3b0025ea9056dc326c22603eff11 100644 (file)
@@ -3743,11 +3743,23 @@ class CydiaLogCleaner :
     return [self popErrorWithTitle:title] || !success;
 }
 
+- (bool) _isEtceteraAptSourcesListDirectoryCydiaListSymbolicallyLinkedToMobileCachesCydiaSourceList {
+    char target[1024];
+    ssize_t length(readlink("/etc/apt/sources.list.d/cydia.list", target, sizeof(target) - 1));
+    if (length == -1)
+        return false;
+    if (length >= sizeof(target))
+        return false;
+    target[length] = '\0';
+    return strcmp(target, "/var/mobile/Library/Caches/com.saurik.Cydia/sources.list") == 0;
+}
+
 - (bool) popErrorWithTitle:(NSString *)title forReadList:(pkgSourceList &)list {
     if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
         return true;
-    if ([self popErrorWithTitle:title forOperation:list.Read(SOURCES_LIST)])
-        return true;
+    if (![self _isEtceteraAptSourcesListDirectoryCydiaListSymbolicallyLinkedToMobileCachesCydiaSourceList])
+        if ([self popErrorWithTitle:title forOperation:list.Read(SOURCES_LIST)])
+            return true;
     return false;
 }