mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-01-25 16:40:31 +07:00
[PATCH] fix problems with dev.d and udevstart
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
This commit is contained in:
parent
e284ecba76
commit
1059b07a14
8
dev_d.c
8
dev_d.c
@ -39,6 +39,7 @@ static int run_program(char *name)
|
|||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int fd;
|
int fd;
|
||||||
|
char *argv[3];
|
||||||
|
|
||||||
dbg("running %s", name);
|
dbg("running %s", name);
|
||||||
|
|
||||||
@ -54,7 +55,12 @@ static int run_program(char *name)
|
|||||||
dup2(fd, STDERR_FILENO);
|
dup2(fd, STDERR_FILENO);
|
||||||
}
|
}
|
||||||
close(fd);
|
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");
|
dbg("exec of child failed");
|
||||||
exit(1);
|
exit(1);
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -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]);
|
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);
|
retval = pipe(fds);
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
dbg("pipe failed");
|
dbg("pipe failed");
|
||||||
|
Loading…
Reference in New Issue
Block a user