- Allow relative pathnames for options::pidfile and options::scanlog
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 14 Jul 2015 10:39:54 +0000 (10:39 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 14 Jul 2015 10:39:54 +0000 (10:39 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.1.x@6277 82007160-df01-0410-b94d-b575c5fd34c7

doc/reference.conf
src/Makefile.am
src/main.c

index 0f8d55b4da7216cd0d476f93ca7d3ae881e8118c..476ab281da349ae6f9aea942a1a73bf5d856b8ff 100644 (file)
@@ -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";
 };
 
 
index f918af04d7b79e62c5cfb83d5396b584818107d4..e30736bae90d8f6e7dcfee7ed14b31c5edf8b37e 100644 (file)
@@ -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        \
index cbbaf369672ee49dd542b9c1e35d9f419b3caf31..41f4bb21198340844a919a800592771df8259b98 100644 (file)
@@ -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)
   {