aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-01-05 17:42:13 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-01-05 18:31:05 +0200
commit7dd7f4e2d7a5eaed676651caf456c1de0704b7cd (patch)
tree2073caae8a686914c84b5bde8bcdf59331240ea6 /src/pies.c
parent6ac0f1e8e19922c63a1542740a7c88116989bb7c (diff)
downloadpies-7dd7f4e2d7a5eaed676651caf456c1de0704b7cd.tar.gz
pies-7dd7f4e2d7a5eaed676651caf456c1de0704b7cd.tar.bz2
Include argv in the output of ctl id command.
* ctl.c (res_instance): Include "argv" in the return json. Use pies_master_argv[0] to report binary path. * pies.c (pies_master_argv,pies_master_argc): New globals. (main): Initialize them. Refuse to restart unless argv[0] begins with a slash. * pies.h (pies_master_argv,pies_master_argc): New globals. * piesctl.c (com_id): Rewrite output formatting.
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/pies.c b/src/pies.c
index f069552..875684a 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -2130,6 +2130,9 @@ set_state_file_names (const char *base)
qotdfile = mkfilename (statedir, base, ".qotd");
}
+size_t pies_master_argc;
+char **pies_master_argv;
+
int
main (int argc, char **argv)
{
@@ -2146,6 +2149,9 @@ main (int argc, char **argv)
textdomain (PACKAGE);
#endif
mf_proctitle_init (argc, argv, environ);
+
+ pies_master_argc = argc;
+ pies_master_argv = argv;
set_quoting_style (NULL, shell_quoting_style);
@@ -2392,8 +2398,15 @@ main (int argc, char **argv)
pies_pause ();
switch (action)
{
- case ACTION_STOP:
case ACTION_RESTART:
+ if (argv[0][0] != '/' || init_process)
+ {
+ logmsg (LOG_INFO, _("restart command ignored"));
+ action = ACTION_CONT;
+ }
+ break;
+
+ case ACTION_STOP:
if (init_process)
{
debug (1, ("ignoring stop/restart"));
@@ -2436,7 +2449,7 @@ main (int argc, char **argv)
progman_stop ();
remove_pidfile (pidfile);
- if (action == ACTION_RESTART && argv[0][0] == '/')
+ if (action == ACTION_RESTART)
{
int minfd = DIAG_OUTPUT (DIAG_TO_STDERR) ? 2 : 0;
int i;

Return to:

Send suggestions and report system problems to the System administrator.