diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2015-07-02 08:25:46 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2015-07-02 08:25:46 -0700 |
commit | 93524d32b3c75083549e3871dcd10db30c94283d (patch) | |
tree | b7472bd681f76ebfed6d9fb5ae8a0597d5c8c433 /MobileCydia.mm | |
parent | db1e5e0dbbf6724f462644ef4987175888ba90b1 (diff) |
Don't inject sources.list if cydia.list is linked.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index a636eeb..75d2842 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -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; } |