summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-05-17 17:33:19 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-17 17:33:19 (GMT)
commitc63b903713b6ec5600b11d6197c5c0c11f3b0247 (patch) (unidiff)
tree64d3195506272890e1d60a96a3d4e119fbfdec8d
parenta3240e8cdde7d311cf006217d894a00398d4f130 (diff)
downloadpies-c63b903713b6ec5600b11d6197c5c0c11f3b0247.tar.gz
pies-c63b903713b6ec5600b11d6197c5c0c11f3b0247.tar.bz2
Provide an option to disable SysV init mode.
This is useful if pies is run as a entrypoint process in a docker container.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/cmdline.opt6
-rw-r--r--src/pies.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 5380b80..57f5b90 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -55,6 +55,12 @@ BEGIN
55 foreground = 1; 55 foreground = 1;
56END 56END
57 57
58OPTION(no-init,,,
59 [<don't suppose SysV init mode if PID is 1>])
60BEGIN
61 /* handled separately */
62END
63
58OPTION(inetd,i,, 64OPTION(inetd,i,,
59 [<run in inetd mode>]) 65 [<run in inetd mode>])
60BEGIN 66BEGIN
diff --git a/src/pies.c b/src/pies.c
index c0c1306..503be73 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -2032,6 +2032,7 @@ main (int argc, char **argv)
2032 extern char **environ; 2032 extern char **environ;
2033 struct grecs_list_entry *ep; 2033 struct grecs_list_entry *ep;
2034 int diag_flags; 2034 int diag_flags;
2035 int i;
2035 2036
2036 set_program_name (argv[0]); 2037 set_program_name (argv[0]);
2037#ifdef ENABLE_NLS 2038#ifdef ENABLE_NLS
@@ -2049,6 +2050,14 @@ main (int argc, char **argv)
2049 set_quoting_style (NULL, shell_quoting_style); 2050 set_quoting_style (NULL, shell_quoting_style);
2050 2051
2051 init_process = getpid () == 1; 2052 init_process = getpid () == 1;
2053 for (i = 1; i < argc; i++)
2054 {
2055 if (strcmp (argv[i], "--no-init") == 0)
2056 {
2057 init_process = 0;
2058 break;
2059 }
2060 }
2052 2061
2053 /* Set default logging */ 2062 /* Set default logging */
2054 if (init_process) 2063 if (init_process)

Return to:

Send suggestions and report system problems to the System administrator.