mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 13:17:56 +00:00
Fix 'stop' command
Do not fail with error if servald.pid is nonexistent/inaccessible
This commit is contained in:
parent
08768a7c8c
commit
8dd9a70852
@ -636,14 +636,15 @@ int app_server_stop(int argc, const char *const *argv, struct command_line_optio
|
||||
if (cli_arg(argc, argv, o, "instance path", &thisinstancepath, cli_absolute_path, NULL) == -1)
|
||||
return -1;
|
||||
const char *instancepath = serval_instancepath();
|
||||
int pid = server_pid();
|
||||
if (pid < 0)
|
||||
return -1;
|
||||
cli_puts("instancepath");
|
||||
cli_delim(":");
|
||||
cli_puts(instancepath);
|
||||
cli_delim("\n");
|
||||
if (pid) {
|
||||
int pid = server_pid();
|
||||
// If there is no pidfile, then there is no server process to stop.
|
||||
if (pid <= 0)
|
||||
return 1;
|
||||
// Otherwise, we have a server process to stop, so get to work.
|
||||
cli_puts("pid");
|
||||
cli_delim(":");
|
||||
cli_printf("%d", pid);
|
||||
@ -685,8 +686,7 @@ int app_server_stop(int argc, const char *const *argv, struct command_line_optio
|
||||
cli_delim(":");
|
||||
cli_printf("%d", tries);
|
||||
cli_delim("\n");
|
||||
}
|
||||
return pid ? 0 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_server_status(int argc, const char *const *argv, struct command_line_option *o)
|
||||
|
Loading…
Reference in New Issue
Block a user