chiark / gitweb /
prepare moving of /sys/class devices to /sys/devices
[elogind.git] / udev_utils_run.c
index 20aaa4ab05e386951a8d445d592553c5786f725e..b6020b0ab6baea9f1f0d22e24385c3d213aad13f 100644 (file)
 #include <sys/wait.h>
 #include <sys/select.h>
 
-#include "udev_libc_wrapper.h"
 #include "udev.h"
-#include "logging.h"
-#include "udev_utils.h"
-#include "list.h"
 
 
 int pass_env_to_socket(const char *sockname, const char *devpath, const char *action)
@@ -82,6 +78,7 @@ int run_program(const char *command, const char *subsystem,
        int errpipe[2] = {-1, -1};
        pid_t pid;
        char arg[PATH_SIZE];
+       char program[PATH_SIZE];
        char *argv[(sizeof(arg) / 2) + 1];
        int devnull;
        int i;
@@ -126,6 +123,13 @@ int run_program(const char *command, const char *subsystem,
                }
        }
 
+       /* allow programs in /lib/udev called without the path */
+       if (strchr(argv[0], '/') == NULL) {
+               strlcpy(program, "/lib/udev/", sizeof(program));
+               strlcat(program, argv[0], sizeof(program));
+               argv[0] = program;
+       }
+
        pid = fork();
        switch(pid) {
        case 0: