]> git.ozlabs.org Git - petitboot/blobdiff - lib/system/system.c
Add --start-daemon option to ui programs
[petitboot] / lib / system / system.c
index 7371445a876d0bdbd8e7ad2d7da49a5aa266e743..1b506d2edaf6b5e84f9ea4211e0cac1b189f3d31 100644 (file)
@@ -17,6 +17,7 @@
 #include "system.h"
 
 const struct pb_system_apps pb_system_apps = {
+       .prefix = PREFIX,
        .cp = "/bin/cp",
        .kexec = "/sbin/kexec",
        .mount = "/bin/mount",
@@ -104,7 +105,7 @@ int pb_rmdir_recursive(const char *base, const char *dir)
  * @cmd_argv: An argument list array for execv.
  */
 
-int pb_run_cmd(const char *const *cmd_argv)
+int pb_run_cmd(const char *const *cmd_argv, int wait)
 {
 #if defined(DEBUG)
        enum {do_debug = 1};
@@ -149,6 +150,9 @@ int pb_run_cmd(const char *const *cmd_argv)
                exit(EXIT_FAILURE);
        }
 
+       if (!wait && !waitpid(pid, &status, WNOHANG))
+               return 0;
+
        if (waitpid(pid, &status, 0) == -1) {
                pb_log("%s: waitpid failed: %s\n", __func__,
                                strerror(errno));