[systemd-commits] 2 commits - src/core src/delta src/login src/nspawn src/quotacheck src/shared src/vconsole

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Sat Nov 29 08:11:31 PST 2014


 src/core/shutdown.c           |    2 +-
 src/delta/delta.c             |    2 +-
 src/login/inhibit.c           |    2 +-
 src/nspawn/nspawn.c           |   13 ++++++++++---
 src/quotacheck/quotacheck.c   |    2 +-
 src/shared/util.c             |   22 ++++++++++++----------
 src/shared/util.h             |    2 +-
 src/vconsole/vconsole-setup.c |    4 ++--
 8 files changed, 29 insertions(+), 20 deletions(-)

New commits:
commit 01dc33ce287c68bf6bbc22f5b1d5eb29e204b6a7
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Nov 29 11:06:05 2014 -0500

    nspawn: fix unused variable warning

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index b6fa8fc..fed150e 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2078,7 +2078,14 @@ static int dissect_image(
                 bool *secondary) {
 
 #ifdef HAVE_BLKID
-        int home_nr = -1, root_nr = -1, secondary_root_nr = -1, srv_nr = -1;
+        int home_nr = -1, srv_nr = -1;
+#ifdef GPT_ROOT_NATIVE
+        int root_nr = -1;
+#endif
+#ifdef GPT_ROOT_SECONDARY
+        int secondary_root_nr = -1;
+#endif
+
         _cleanup_free_ char *home = NULL, *root = NULL, *secondary_root = NULL, *srv = NULL;
         _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
         _cleanup_udev_device_unref_ struct udev_device *d = NULL;

commit 820d3acfe924e58965d14b4711d5df31c5db199a
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Nov 29 10:28:01 2014 -0500

    delta: diff returns 1 when files differ, ignore this
    
    https://bugs.debian/org/771397

diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 2cd0bce..def20f5 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -367,7 +367,7 @@ int main(int argc, char *argv[]) {
                                 execv(args[0], (char * const *) args);
                                 _exit(EXIT_FAILURE);
                         } else
-                                wait_for_terminate_and_warn("kexec", pid);
+                                wait_for_terminate_and_warn("kexec", pid, true);
                 }
 
                 cmd = RB_AUTOBOOT;
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 438091c..9930571 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -193,7 +193,7 @@ static int found_override(const char *top, const char *bottom) {
                 _exit(1);
         }
 
-        wait_for_terminate_and_warn("diff", pid);
+        wait_for_terminate_and_warn("diff", pid, false);
         putchar('\n');
 
         return k;
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index b81cf0f..44bda34 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -280,7 +280,7 @@ int main(int argc, char *argv[]) {
                         _exit(EXIT_FAILURE);
                 }
 
-                r = wait_for_terminate_and_warn(argv[optind], pid);
+                r = wait_for_terminate_and_warn(argv[optind], pid, true);
                 return r < 0 ? EXIT_FAILURE : r;
         }
 
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 25f835c..b6fa8fc 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2544,7 +2544,7 @@ static int change_uid_gid(char **_home) {
 
         truncate_nl(line);
 
-        wait_for_terminate_and_warn("getent passwd", pid);
+        wait_for_terminate_and_warn("getent passwd", pid, true);
 
         x = strchr(line, ':');
         if (!x) {
@@ -2628,7 +2628,7 @@ static int change_uid_gid(char **_home) {
 
         truncate_nl(line);
 
-        wait_for_terminate_and_warn("getent initgroups", pid);
+        wait_for_terminate_and_warn("getent initgroups", pid, true);
 
         /* Skip over the username and subsequent separator whitespace */
         x = line;
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c
index bf79d1d..9ae3abd 100644
--- a/src/quotacheck/quotacheck.c
+++ b/src/quotacheck/quotacheck.c
@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
                 _exit(1); /* Operational error */
         }
 
-        r = wait_for_terminate_and_warn("quotacheck", pid);
+        r = wait_for_terminate_and_warn("quotacheck", pid, true);
 
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/src/shared/util.c b/src/shared/util.c
index 4c380b8..2165170 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 13da942..b53a45d 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);
 
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 40e4b22..b7a536b 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -308,7 +308,7 @@ int main(int argc, char **argv) {
         }
 
         if (font_pid > 0)
-                wait_for_terminate_and_warn(KBD_SETFONT, font_pid);
+                wait_for_terminate_and_warn(KBD_SETFONT, font_pid, true);
 
         r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid);
         if (r < 0) {
@@ -317,7 +317,7 @@ int main(int argc, char **argv) {
         }
 
         if (keymap_pid > 0)
-                wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+                wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid, true);
 
         /* Only copy the font when we started setfont successfully */
         if (font_copy && font_pid > 0)



More information about the systemd-commits mailing list