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
@@ -904,6 +904,7 @@ str_to_cf (const char *string, int *flags)
904 { "sockenv", CF_SOCKENV }, 904 { "sockenv", CF_SOCKENV },
905 { "resolve", CF_RESOLVE }, 905 { "resolve", CF_RESOLVE },
906 { "siggroup", CF_SIGGROUP }, 906 { "siggroup", CF_SIGGROUP },
907 { "nullinput", CF_NULLINPUT },
907 { NULL } 908 { NULL }
908 }; 909 };
909 910
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
202#define CF_RESOLVE 0x080 /* Resolve IP addresses */ 202#define CF_RESOLVE 0x080 /* Resolve IP addresses */
203#define CF_SIGGROUP 0x100 /* Send signals to the process group */ 203#define CF_SIGGROUP 0x100 /* Send signals to the process group */
204 204
205#define CF_NULLINPUT 0x200 /* Provide null input stream */
206
205#define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS)) 207#define ISCF_TCPMUX(f) ((f) & (CF_TCPMUX | CF_TCPMUXPLUS))
206 208
207struct component 209struct 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)
1207 } 1207 }
1208 else 1208 else
1209 { 1209 {
1210 if (prog->v.p.comp->flags & CF_NULLINPUT)
1211 {
1212 close(0);
1213 if (open("/dev/null", O_RDONLY) != 0)
1214 {
1215 logmsg (LOG_CRIT, "can't open /dev/null: %s",
1216 strerror(errno));
1217 _exit(127);
1218 }
1219 }
1220
1210 if (redir[RETR_OUT] == -1) 1221 if (redir[RETR_OUT] == -1)
1211 { 1222 {
1212 close (1); 1223 close (1);

Return to:

Send suggestions and report system problems to the System administrator.