aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pies.c1
-rw-r--r--src/pies.h2
-rw-r--r--src/progman.c11
3 files changed, 14 insertions, 0 deletions
diff --git a/src/pies.c b/src/pies.c
index e1a7356..b92b7a3 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -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 }
};
diff --git a/src/pies.h b/src/pies.h
index 73f6d18..b627b47 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -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);

Return to:

Send suggestions and report system problems to the System administrator.