From e732e7cb8edb5d619eae90c648bb8f09fcf33b31 Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 1 Sep 2016 21:10:26 +0200 Subject: [PATCH] fix command line in case the pid file is not set --- src/cmd/uts-server.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cmd/uts-server.c b/src/cmd/uts-server.c index eba8e57..52500bf 100644 --- a/src/cmd/uts-server.c +++ b/src/cmd/uts-server.c @@ -82,7 +82,7 @@ int main(int argc, char **argv) { init_pid(args.pidfile); // get the full path for the pid file 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 " "file, uts-server start failed"); return EXIT_FAILURE; @@ -101,9 +101,11 @@ int main(int argc, char **argv) { "uts-server daemon starting with conf '%s' from working dir '%s'", conf_fp, conf_wd); - if (write_pid(pid_file) == 0) { - syslog(LOG_CRIT, "failed to write pid file '%s'", pid_file); - return EXIT_FAILURE; + if (args.pidfile != NULL) { + if (write_pid(pid_file) == 0) { + syslog(LOG_CRIT, "failed to write pid file '%s'", pid_file); + return EXIT_FAILURE; + } } while (1) {