diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-08-20 10:06:55 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-08-20 10:06:55 +0000 |
commit | 1055cfd5777dbfa86fb72e8215a264cb5f0fe636 (patch) | |
tree | fdc20bd9fb94dca6a1c2bd6c09229c9fb2bf3640 /bin/bbackupd | |
parent | 0464bcfd6b131443774b4000224e523452e39de0 (diff) |
* bin/bbackupd/BackupDaemon.cpp
- Cleaned up SyncAllowScript cleanup code
- Fixed catching std::exception while handling command socket to do the
same as catching (...)
Diffstat (limited to 'bin/bbackupd')
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 90c72a20..7c279f73 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -932,32 +932,24 @@ int BackupDaemon::UseScriptToSeeIfSyncAllowed() } } - // Wait and then cleanup child process - int status = 0; - ::waitpid(pid, &status, 0); } catch(std::exception &e) { ::syslog(LOG_ERR, "Internal error running SyncAllowScript: " "%s", e.what()); - // Clean up - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } } catch(...) { // Ignore any exceptions // Log that something bad happened ::syslog(LOG_ERR, "Error running SyncAllowScript '%s'", conf.GetKeyValue("SyncAllowScript").c_str()); - // Clean up though - if(pid != 0) - { - int status = 0; - ::waitpid(pid, &status, 0); - } + } + + // Wait and then cleanup child process, if any + if (pid != 0) + { + int status = 0; + ::waitpid(pid, &status, 0); } return waitInSeconds; @@ -1157,7 +1149,17 @@ void BackupDaemon::WaitOnCommandSocket(box_time_t RequiredDelay, bool &DoSyncFla { ::syslog(LOG_ERR, "Internal error in command socket thread: " "%s", e.what()); - throw; // thread will die + // If an error occurs, and there is a connection active, just close that + // connection and continue. Otherwise, let the error propagate. + if(mpCommandSocketInfo->mpConnectedSocket.get() == 0) + { + throw; // thread will die + } + else + { + // Close socket and ignore error + CloseCommandConnection(); + } } catch(...) { |