diff options
author | Sam Bingner <sam@bingner.com> | 2020-04-06 09:43:46 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-04-08 13:58:02 -1000 |
commit | 004f27bdfbb548d87be5c6f327109e76b973a1ce (patch) | |
tree | d78d5014c757c20a8e11e27b583d5b93cbd03596 /MobileCydia.mm | |
parent | 87cfa306c348a32cdeb646ec6ce283023cfc85f6 (diff) |
Actually fix strange metadata.cb0 crashesv1.1.32%b26
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 9fd0a98..2fffce3 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -9352,9 +9352,19 @@ int main(int argc, char *argv[]) { if ([WebPreferences respondsToSelector:@selector(setWebKitLinkTimeVersion:)]) [WebPreferences setWebKitLinkTimeVersion:PACKED_VERSION(3453,0,0)]; + // Ensure we have a stdout and stderr int fd(open("/tmp/cydia.log", O_WRONLY | O_APPEND | O_CREAT, 0644)); - dup2(fd, 2); - close(fd); + // Added this because stderr output ended up in metadata.cb0 somehow once + // Perhaps we were spawned with stderr or stdout closed? + // + // Ensure we have a stdout and stderr + if (fcntl(STDOUT_FILENO, F_GETFD) == -1) { + dup2(fd, STDOUT_FILENO); + } + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) { + close(fd); + } NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); |