discover: Use pb_run_cmd rather than calling system()
authorJeremy Kerr <jk@ozlabs.org>
Tue, 5 Mar 2013 05:54:55 +0000 (13:54 +0800)
committerGeoff Levand <geoff@infradead.org>
Tue, 5 Mar 2013 14:07:27 +0000 (06:07 -0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>
discover/udev.c

index a5d9e03006dd2af346a1418296526a47aece88ca..fb64221dad1d90036db782a3a1762f441e27e45c 100644 (file)
@@ -13,6 +13,7 @@
 #include <log/log.h>
 #include <talloc/talloc.h>
 #include <waiter/waiter.h>
 #include <log/log.h>
 #include <talloc/talloc.h>
 #include <waiter/waiter.h>
+#include <system/system.h>
 
 #include "event.h"
 #include "udev.h"
 
 #include "event.h"
 #include "udev.h"
@@ -156,7 +157,16 @@ out_err:
 
 int udev_trigger(struct udev __attribute__((unused)) *udev)
 {
 
 int udev_trigger(struct udev __attribute__((unused)) *udev)
 {
-       int rc = system("/sbin/udevadm trigger --subsystem-match=block --action=add");
+       const char *cmd[] = {
+               "/sbin/udevadm,
+               "trigger",
+               "--subsystem-match=block",
+               "--action=add",
+               NULL,
+       };
+       int rc;
+
+       rc = pb_run_cmd(cmd, 1, 0);
 
        if (rc)
                pb_log("udev trigger failed: %d (%d)\n", rc, WEXITSTATUS(rc));
 
        if (rc)
                pb_log("udev trigger failed: %d (%d)\n", rc, WEXITSTATUS(rc));