mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Don't clean up update directory when Autoupdate receives SIGTERM
Under rare circumstances, if Autoupdate receives SIGTERM while the installer queue is installing an update this could cause potential corruption. This is a port of #2479 to 2.2.x branch.
This commit is contained in:
1 parent
47fb37e55d
commit
0066846648
1 file changed
+5
-1
+5
-1
@@ -28,7 +28,11 @@ int main(int __unused argc, const char __unused *argv[])
|
||||
|
||||
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
|
||||
dispatch_source_set_event_handler(sigtermSource, ^{
|
||||
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
|
||||
// Don't clear the update directory because the installer may be in middle of installing an update
|
||||
// We still need to set an event handler for receiving SIGTERM though, otherwise our job may not terminate
|
||||
// (This is also recommended from the developer documentation).
|
||||
// Simply exit with SIGTERM if we recieve this signal
|
||||
exit(SIGTERM);
|
||||
});
|
||||
dispatch_resume(sigtermSource);
|
||||
|
||||
|
||||
Reference in new issue
Block a user