From 3542a13ab11d7b7a96f05ec2052063da2666088d Mon Sep 17 00:00:00 2001 From: kakwa Date: Sat, 28 Jan 2017 03:21:11 +0100 Subject: [PATCH] using more portable dirname() function * removing include of (which include GNU dirname, which doesn't follow posix spec, and force using libgen.h * removing #ifdef for FreeBSD handling of dirname as it's not necessary anymore. --- src/cmd/uts-server.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cmd/uts-server.c b/src/cmd/uts-server.c index 44de33d..eac73fe 100644 --- a/src/cmd/uts-server.c +++ b/src/cmd/uts-server.c @@ -11,7 +11,6 @@ #endif /* BSD */ #include #include -#include #include #include @@ -97,12 +96,9 @@ int main(int argc, char **argv) { // get the directory containing the configuration file // other uts-server files (ca, certs, etc) can be declared relatively to the // configuration file - char *conf_wd = strdup(conf_fp); -#ifdef BSD - conf_wd = dirname(conf_wd); -#else - dirname(conf_wd); -#endif /* BSD */ + char *tmp_wd = strdup(conf_fp); + char *conf_wd = dirname(tmp_wd); + if (args.daemonize) skeleton_daemon(); @@ -124,6 +120,7 @@ int main(int argc, char **argv) { syslog(LOG_NOTICE, "uts-server daemon terminated."); free(conf_wd); + free(tmp_wd); closelog(); return ret;