aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2015-01-21 19:58:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-01-21 19:58:28 +0200
commit891bb67de28c778827d4841b04d440caac8be18a (patch)
treed0bea7989ba987122a2296ef4adffeb8a5178971 /src
parentcb8b9461907373485acabb90bc1cad5263abc8b8 (diff)
downloadpies-891bb67de28c778827d4841b04d440caac8be18a.tar.gz
pies-891bb67de28c778827d4841b04d440caac8be18a.tar.bz2
New component flag: nullinput
* NEWS: Update. * doc/pies.texi: Document nullinput flag. * src/pies.c (str_to_cf): New flag: nullinput * src/pies.h (CF_NULLINPUT): New flag. * src/progman.c (prog_start): If CF_NULLINPUT flag is set, redirect /dev/null to the stdin
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
@@ -906,2 +906,3 @@ str_to_cf (const char *string, int *flags)
{ "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
@@ -204,2 +204,4 @@ enum pies_comp_mode
+#define CF_NULLINPUT 0x200 /* Provide null input stream */
+
#define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS))
diff --git a/src/progman.c b/src/progman.c
index e666535..1455f67 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -1209,2 +1209,13 @@ prog_start (struct prog *prog)
{
+ 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)

Return to:

Send suggestions and report system problems to the System administrator.