]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
[PATCH] fix problems with dev.d and udevstart
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Thu, 7 Oct 2004 07:17:11 +0000 (00:17 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:37:03 +0000 (21:37 -0700)
Here is the correction for the dev.d/ scripts too. We should pass
the right argv[0] here too. A script may depend on the right value, as
udev does with udev/udevstart.

Here is the old version:
  [pid  4692] execve("/etc/dev.d/default/log.dev", ["./udev", "block"], [/* 41 vars */]) = 0

this the new one:
  [pid  9832] execve("/etc/dev.d/default/log.dev", ["/etc/dev.d/default/log.dev", "block"], [/* 41 vars */]) = 0

dev_d.c
namedev.c

diff --git a/dev_d.c b/dev_d.c
index c091f11c28726cc02d5a165bdecd38d7befad1da..eaf9b1dc12c7ecef5364a373041f380f5d964d89 100644 (file)
--- a/dev_d.c
+++ b/dev_d.c
@@ -39,6 +39,7 @@ static int run_program(char *name)
 {
        pid_t pid;
        int fd;
+       char *argv[3];
 
        dbg("running %s", name);
 
@@ -54,7 +55,12 @@ static int run_program(char *name)
                        dup2(fd, STDERR_FILENO);
                }
                close(fd);
-               execv(name, main_argv);
+
+               argv[0] = name;
+               argv[1] = main_argv[1];
+               argv[2] = NULL;
+
+               execv(name, argv);
                dbg("exec of child failed");
                exit(1);
        case -1:
index 3843d028693c305b4bf0e15ae93f14e4b3589815..695fb55413910e7507b408425529875f1db4c759 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -450,11 +450,6 @@ static int execute_program(const char *path, char *value, int len)
                dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]);
        }
 
-       /* set basename() only */
-       pos = strrchr(argv[0], '/');
-       if (pos != NULL)
-               argv[0] = &pos[1];
-
        retval = pipe(fds);
        if (retval != 0) {
                dbg("pipe failed");