fix command line in case the pid file is not set
This commit is contained in:
parent
b00bdbc5f9
commit
e732e7cb8e
|
@ -82,7 +82,7 @@ int main(int argc, char **argv) {
|
||||||
init_pid(args.pidfile);
|
init_pid(args.pidfile);
|
||||||
// get the full path for the pid file
|
// get the full path for the pid file
|
||||||
char pid_file[PATH_MAX];
|
char pid_file[PATH_MAX];
|
||||||
if (realpath(args.pidfile, pid_file) == NULL) {
|
if ((args.pidfile != NULL) && realpath(args.pidfile, pid_file) == NULL) {
|
||||||
syslog(LOG_CRIT, "unable to get the full path of the pid "
|
syslog(LOG_CRIT, "unable to get the full path of the pid "
|
||||||
"file, uts-server start failed");
|
"file, uts-server start failed");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -101,9 +101,11 @@ int main(int argc, char **argv) {
|
||||||
"uts-server daemon starting with conf '%s' from working dir '%s'",
|
"uts-server daemon starting with conf '%s' from working dir '%s'",
|
||||||
conf_fp, conf_wd);
|
conf_fp, conf_wd);
|
||||||
|
|
||||||
if (write_pid(pid_file) == 0) {
|
if (args.pidfile != NULL) {
|
||||||
syslog(LOG_CRIT, "failed to write pid file '%s'", pid_file);
|
if (write_pid(pid_file) == 0) {
|
||||||
return EXIT_FAILURE;
|
syslog(LOG_CRIT, "failed to write pid file '%s'", pid_file);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
Loading…
Reference in New Issue