From 6a51327b668f0e5c0040582b25d20632df79b060 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 14 Jul 2015 10:39:54 +0000 Subject: [PATCH] - Allow relative pathnames for options::pidfile and options::scanlog git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.1.x@6277 82007160-df01-0410-b94d-b575c5fd34c7 --- doc/reference.conf | 4 ++-- src/Makefile.am | 2 +- src/main.c | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/reference.conf b/doc/reference.conf index 0f8d55b..476ab28 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -24,7 +24,7 @@ options { * Full path and filename for storing the process ID of the running * HOPM. */ - pidfile = "/some/path/var/run/hopm.pid"; + pidfile = "var/run/hopm.pid"; /* * How long to store the IP address of hosts which are confirmed @@ -70,7 +70,7 @@ options { * the scan in question can be useful. Leave commented for no * logging. */ -# scanlog = "/some/path/var/log/scan.log"; +# scanlog = "var/log/scan.log"; }; diff --git a/src/Makefile.am b/src/Makefile.am index f918af0..e30736b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = libopm bin_PROGRAMS = hopm -AM_CPPFLAGS = -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" +AM_CPPFLAGS = -DHOPM_PREFIX="\"$(prefix)\"" -DHOPM_ETCDIR="\"$(sysconfdir)\"" -DHOPM_LOGDIR="\"$(localstatedir)/log\"" AM_YFLAGS = -d hopm_SOURCES = compat.c \ diff --git a/src/main.c b/src/main.c index cbbaf36..41f4bb2 100644 --- a/src/main.c +++ b/src/main.c @@ -117,6 +117,12 @@ main(int argc, char *argv[]) snprintf(CONFFILE, lenc, "%s/%s.%s", CONFDIR, CONFNAME, CONFEXT); snprintf(LOGFILE, lenl, "%s/%s.%s", LOGDIR, CONFNAME, LOGEXT); + if (chdir(HOPM_PREFIX)) + { + perror("chdir"); + exit(EXIT_FAILURE); + } + /* Fork off. */ if (OPT_DEBUG == 0) { -- 2.30.2