ui/common: Free message on return
[petitboot] / ui / common / ui-system.c
index ad3bfba8a9d4534507f849925fd3e2b42bc26afd..7e04801edf9a96a8e146ad050074e32256779707 100644 (file)
@@ -16,7 +16,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define _GNU_SOURCE
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
 
 #include <assert.h>
 #include <errno.h>
@@ -28,6 +30,7 @@
 
 #include "log/log.h"
 #include <system/system.h>
+#include <process/process.h>
 #include "talloc/talloc.h"
 #include "ui-system.h"
 
  * pb_start_daemon - start the pb-discover daemon.
  */
 
-int pb_start_daemon(void)
+int pb_start_daemon(void *ctx)
 {
+       struct process *process;
+       const char **argv;
        int result;
-       const char *argv[2];
-       char *name = talloc_asprintf(NULL, "%s/sbin/pb-discover",
-               pb_system_apps.prefix);
+       char *name;
 
-       argv[0] = name;
-       argv[1] =  NULL;
+       process = process_create(ctx);
+
+       argv = talloc_array(process, const char *, 2);
+       name = talloc_asprintf(process, "%s/sbin/pb-discover",
+                       pb_system_apps.prefix);
 
-       result = pb_run_cmd(argv, 0, 0);
+       argv[0] = name;
+       argv[1] = NULL;
 
-       talloc_free(name);
+       process->path = name;
+       process->argv = argv;
 
-       if (result)
-               pb_log("%s: failed: (%d)\n", __func__, result);
+       result = process_run_async(process);
+       process_release(process);
 
        return result;
 }