]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Show a warning on startup if config file is not a full path
authorAlexander Barton <alex@barton.de>
Tue, 11 Sep 2012 09:40:47 +0000 (11:40 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 11 Sep 2012 09:40:47 +0000 (11:40 +0200)
ngIRCd is a long-running process and changes its working directory to "/" to
not block mounted filesystems and the like when running as daemon ("not in the
foreground"); therefore the path to the configuration file must be relative to
"/" (or the chroot() directory), which basically is "not relative", to ensure
that "kill -HUP" and the "REHASH" command work as expected later on.

This fixes parts of bug #127.

src/ngircd/conf.c

index 034281c06a86ac7c42bc3edb6adffcaa3fb0d0ae..627e6d3fbf22557d695478ffe2a507b5fafe2a4d 100644 (file)
@@ -1911,6 +1911,13 @@ Validate_Config(bool Configtest, bool Rehash)
        bool config_valid = true;
        char *ptr;
 
        bool config_valid = true;
        char *ptr;
 
+       /* Emit a warning when the config file is not a full path name */
+       if (NGIRCd_ConfFile[0] && NGIRCd_ConfFile[0] != '/') {
+               Config_Error(LOG_WARNING,
+                       "Not specifying a full path name to \"%s\" can cause problems when rehashing the server!",
+                       NGIRCd_ConfFile);
+       }
+
        /* Validate configured server name, see RFC 2812 section 2.3.1 */
        ptr = Conf_ServerName;
        do {
        /* Validate configured server name, see RFC 2812 section 2.3.1 */
        ptr = Conf_ServerName;
        do {