From: michael Date: Tue, 14 Jul 2015 10:39:10 +0000 (+0000) Subject: - Allow relative pathnames for options::pidfile and options::scanlog X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=1f16aac953050af6bd54a8865ab6aef0ce318b06;p=hopm.git - Allow relative pathnames for options::pidfile and options::scanlog git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@6276 82007160-df01-0410-b94d-b575c5fd34c7 --- 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) {