mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 12:25:22 +00:00
Fix EXC_GUARD crash: avoid closing Tor-owned fd on tor exit\n\nCTorHost: stop calling close(owning_fd_tor) in tor_thread_main. Tor already\ncloses its end; closing a reused guarded fd can trigger EXC_GUARD on iOS 18.\nWe now treat it as Tor-owned and just invalidate our reference.
This commit is contained in:
@@ -40,7 +40,11 @@ static void *tor_thread_main(void *arg) {
|
|||||||
int rc = tor_run_main(cfg); // blocks until tor exits
|
int rc = tor_run_main(cfg); // blocks until tor exits
|
||||||
tor_main_configuration_free(cfg);
|
tor_main_configuration_free(cfg);
|
||||||
if (argv_owned) { free(argv_owned); argv_owned = NULL; argv_owned_argc = 0; }
|
if (argv_owned) { free(argv_owned); argv_owned = NULL; argv_owned_argc = 0; }
|
||||||
if (owning_fd_tor != -1) { close(owning_fd_tor); owning_fd_tor = -1; }
|
// Do not close owning_fd_tor here: Tor may have already closed it and the
|
||||||
|
// fd number could have been re-used by the time we get here. On iOS 18,
|
||||||
|
// attempting to close a re-used guarded fd can trigger EXC_GUARD. Treat the
|
||||||
|
// tor-side end as owned by Tor and simply forget our reference.
|
||||||
|
owning_fd_tor = -1;
|
||||||
return (void*)(intptr_t)rc;
|
return (void*)(intptr_t)rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user