chiark / gitweb /
[PATCH] update the man page to reflect the recent changes
[elogind.git] / udev_multiplex.c
index 9ab11e6beaa2fa59c8c061446100e556260a2f64..22bbaf7b614bcef316cf28454b2b9793814f45da 100644 (file)
 #include "udev_utils.h"
 #include "logging.h"
 
-static int run_program(struct udevice *udev, const char *filename)
-{
-       pid_t pid;
-       int fd;
-
-       dbg("running %s", filename);
-
-       pid = fork();
-       switch (pid) {
-       case 0:
-               /* child */
-               fd = open("/dev/null", O_RDWR);
-               if ( fd >= 0) {
-                       dup2(fd, STDOUT_FILENO);
-                       dup2(fd, STDIN_FILENO);
-                       dup2(fd, STDERR_FILENO);
-               }
-               close(fd);
-
-               execl(filename, filename, udev->subsystem, NULL);
-               dbg("exec of child failed");
-               _exit(1);
-       case -1:
-               dbg("fork of child failed");
-               break;
-               return -1;
-       default:
-               waitpid(pid, NULL, 0);
-       }
-
-       return 0;
-}
 
 /* 
  * runs files in these directories in order:
@@ -117,7 +85,7 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c
        add_matching_files(&name_list, dirname, suffix);
 
        list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) {
-               run_program(udev, name_loop->name);
+               execute_command(name_loop->name, udev->subsystem);
                list_del(&name_loop->node);
        }