diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2010-04-23 12:18:03 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2010-04-28 08:06:57 +0200 |
commit | ea3fafe99c4ec567881283eb68d18e84d223b32d (patch) | |
tree | ada3e87be6b2c6d4123a1bfd7680c1ade11dfea6 /src | |
parent | f0af60b6a801058a3b0d43f194d99046245aba82 (diff) |
syncevo-phone-config: let CTRL-C really abort syncevolution (MBC #1197)
The signal handler in syncevolution interpret CTRL-C as suspend
request. When invoked by syncevo-phone-config, that is not what is
intended by the user and usually had the effect that a sync session
failed without flagging the abort request, thus keeping the script
running.
This patch adds SYNCEVOLUTION_NO_SYNC_SIGNALS, which prevents
installing the signal handlers, and uses that in the script.
As a result, CTRL-C leads to "aborted prematurely", for which
a test was added earlier.
Because syncevolution has to do no cleanup work, aborting it
like this is okay.
Diffstat (limited to 'src')
-rw-r--r-- | src/syncevo/SyncContext.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp index 0b8f0f9c..28f49748 100644 --- a/src/syncevo/SyncContext.cpp +++ b/src/syncevo/SyncContext.cpp @@ -2988,13 +2988,14 @@ SyncMLStatus SyncContext::doSync() new_action.sa_handler = handleSignal; sigemptyset(&new_action.sa_mask); sigaction(SIGINT, NULL, &old_action); - if (old_action.sa_handler == SIG_DFL) { + bool catchSignals = getenv("SYNCEVOLUTION_NO_SYNC_SIGNALS") == NULL; + if (catchSignals && old_action.sa_handler == SIG_DFL) { sigaction(SIGINT, &new_action, NULL); } struct sigaction old_term_action; sigaction(SIGTERM, NULL, &old_term_action); - if (old_term_action.sa_handler == SIG_DFL) { + if (catchSignals && old_term_action.sa_handler == SIG_DFL) { sigaction(SIGTERM, &new_action, NULL); } @@ -3541,8 +3542,10 @@ SyncMLStatus SyncContext::doSync() } m_agent.reset(); - sigaction (SIGINT, &old_action, NULL); - sigaction (SIGTERM, &old_term_action, NULL); + if (catchSignals) { + sigaction (SIGINT, &old_action, NULL); + sigaction (SIGTERM, &old_term_action, NULL); + } return status; } |