diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pies.c | 1 | ||||
-rw-r--r-- | src/pies.h | 2 | ||||
-rw-r--r-- | src/progman.c | 11 |
3 files changed, 14 insertions, 0 deletions
@@ -904,6 +904,7 @@ str_to_cf (const char *string, int *flags) { "sockenv", CF_SOCKENV }, { "resolve", CF_RESOLVE }, { "siggroup", CF_SIGGROUP }, + { "nullinput", CF_NULLINPUT }, { NULL } }; @@ -202,6 +202,8 @@ enum pies_comp_mode #define CF_RESOLVE 0x080 /* Resolve IP addresses */ #define CF_SIGGROUP 0x100 /* Send signals to the process group */ +#define CF_NULLINPUT 0x200 /* Provide null input stream */ + #define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS)) struct component diff --git a/src/progman.c b/src/progman.c index e666535..1455f67 100644 --- a/src/progman.c +++ b/src/progman.c @@ -1207,6 +1207,17 @@ prog_start (struct prog *prog) } else { + if (prog->v.p.comp->flags & CF_NULLINPUT) + { + close(0); + if (open("/dev/null", O_RDONLY) != 0) + { + logmsg (LOG_CRIT, "can't open /dev/null: %s", + strerror(errno)); + _exit(127); + } + } + if (redir[RETR_OUT] == -1) { close (1); |