diff options
| author | Florian Eckert | 2025-04-08 10:01:21 +0000 |
|---|---|---|
| committer | Daniel Golle | 2026-02-09 11:06:54 +0000 |
| commit | 64f97ffb6a26582ab0deac87c653723566efe9d9 (patch) | |
| tree | 364190ecdda39458deb9db905a8475fb75c859e4 | |
| parent | c4e9859876d5db7d8d69e8dc92bc7fde44ee96ec (diff) | |
hotplug-dispatch: redirect output to /dev/null
During the hotplug call via the procd, a list is first created with the files
in the hotplug.d directory. After that the scripts are then executed in
lexical order. However, if a script is deleted after the list has been
created, the following message is displayed on the tty console.
Command failed: Not found
/bin/sh: .: line 1: can't open '/etc/hotplug.d/ntp/25-travelmate_ntp': No such file or directory
So that the message is not displayed in the tty console the 'stderr' must be
redirected to '/dev/null'.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
| -rw-r--r-- | hotplug-dispatch.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hotplug-dispatch.c b/hotplug-dispatch.c index c89c90a..aa0fcb9 100644 --- a/hotplug-dispatch.c +++ b/hotplug-dispatch.c @@ -33,6 +33,7 @@ #include <libubus.h> #include "procd.h" +#include "utils/utils.h" #define HOTPLUG_BASEDIR "/etc/hotplug.d" #define HOTPLUG_OBJECT_PREFIX "hotplug." @@ -120,7 +121,10 @@ static void hotplug_exec(struct uloop_timeout *t) pc->process.pid = fork(); if (pc->process.pid == 0) { /* child */ - exit(execve(exec_argv[0], exec_argv, pc->envp)); + patch_stdio("/dev/null"); + execve(exec_argv[0], exec_argv, pc->envp); + ERROR("Failed to execute script: %m\n"); + exit(EXIT_FAILURE); } else if (pc->process.pid < 0) { /* fork error */ free(script); |