diff options
| author | Florian Eckert | 2025-04-08 10:01:21 +0000 |
|---|---|---|
| committer | Daniel Golle | 2026-03-14 00:29:08 +0000 |
| commit | c268f13ab8b8e60d69aabc9ee42b9c0b7d191ed5 (patch) | |
| tree | b6ac0b51fdc961fdef68de69947f7155bffa266a | |
| parent | b8c4f862cb1dbc3c742cbd4953a7c636f73765fc (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>
(cherry picked from commit 64f97ffb6a26582ab0deac87c653723566efe9d9)
| -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 16c22b7..d99c30d 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); |