mirror of
https://github.com/kakwa/uts-server
synced 2025-01-10 13:44:29 +01:00
using more portable dirname() function
* removing include of <string.h> (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.
This commit is contained in:
parent
e9d4d97437
commit
66c055b3a4
@ -11,7 +11,6 @@
|
|||||||
#endif /* BSD */
|
#endif /* BSD */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -97,12 +96,9 @@ int main(int argc, char **argv) {
|
|||||||
// get the directory containing the configuration file
|
// get the directory containing the configuration file
|
||||||
// other uts-server files (ca, certs, etc) can be declared relatively to the
|
// other uts-server files (ca, certs, etc) can be declared relatively to the
|
||||||
// configuration file
|
// configuration file
|
||||||
char *conf_wd = strdup(conf_fp);
|
char *tmp_wd = strdup(conf_fp);
|
||||||
#ifdef BSD
|
char *conf_wd = dirname(tmp_wd);
|
||||||
conf_wd = dirname(conf_wd);
|
|
||||||
#else
|
|
||||||
dirname(conf_wd);
|
|
||||||
#endif /* BSD */
|
|
||||||
if (args.daemonize)
|
if (args.daemonize)
|
||||||
skeleton_daemon();
|
skeleton_daemon();
|
||||||
|
|
||||||
@ -124,6 +120,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
syslog(LOG_NOTICE, "uts-server daemon terminated.");
|
syslog(LOG_NOTICE, "uts-server daemon terminated.");
|
||||||
free(conf_wd);
|
free(conf_wd);
|
||||||
|
free(tmp_wd);
|
||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user