summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-11-29 10:28:01 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-11-29 11:10:51 -0500
commit820d3acfe924e58965d14b4711d5df31c5db199a (patch)
tree11ed7d9a4a69e3bd731d4459ce0d6feeed239a3a /src/shared
parent56e73b34ce0b020ef54c0dc2aba16e50d4fea9f5 (diff)
delta: diff returns 1 when files differ, ignore this
https://bugs.debian/org/771397
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c22
-rw-r--r--src/shared/util.h2
2 files changed, 13 insertions, 11 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 4c380b8b90..21651708d5 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3786,8 +3786,11 @@ int wait_for_terminate(pid_t pid, siginfo_t *status) {
*
* That is, success is indicated by a return value of zero, and an
* error is indicated by a non-zero value.
+ *
+ * A warning is emitted if the process terminates abnormally,
+ * and also if it returns non-zero unless check_exit_code is true.
*/
-int wait_for_terminate_and_warn(const char *name, pid_t pid) {
+int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code) {
int r;
siginfo_t status;
@@ -3799,14 +3802,13 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
return log_warning_errno(r, "Failed to wait for %s: %m", name);
if (status.si_code == CLD_EXITED) {
- if (status.si_status != 0) {
- log_warning("%s failed with error code %i.", name, status.si_status);
- return status.si_status;
- }
-
- log_debug("%s succeeded.", name);
- return 0;
+ if (status.si_status != 0)
+ log_full(check_exit_code ? LOG_WARNING : LOG_DEBUG,
+ "%s failed with error code %i.", name, status.si_status);
+ else
+ log_debug("%s succeeded.", name);
+ return status.si_status;
} else if (status.si_code == CLD_KILLED ||
status.si_code == CLD_DUMPED) {
@@ -4161,13 +4163,13 @@ void execute_directory(const char *directory, DIR *d, usec_t timeout, char *argv
path = hashmap_remove(pids, UINT_TO_PTR(pid));
assert(path);
- wait_for_terminate_and_warn(path, pid);
+ wait_for_terminate_and_warn(path, pid, true);
}
_exit(EXIT_SUCCESS);
}
- wait_for_terminate_and_warn(directory, executor_pid);
+ wait_for_terminate_and_warn(directory, executor_pid, true);
}
int kill_and_sigcont(pid_t pid, int sig) {
diff --git a/src/shared/util.h b/src/shared/util.h
index 13da9426dd..b53a45da9d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -513,7 +513,7 @@ char *unquote(const char *s, const char *quotes);
char *normalize_env_assignment(const char *s);
int wait_for_terminate(pid_t pid, siginfo_t *status);
-int wait_for_terminate_and_warn(const char *name, pid_t pid);
+int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code);
noreturn void freeze(void);