Chdir() to the configuration directory instead of /.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 17 Apr 2016 12:04:57 +0000 (14:04 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 17 Apr 2016 12:04:57 +0000 (14:04 +0200)
src/process.c
src/tincd.c

index cbc816be5b5667c2100e07f671929cffe7d2c8fc..5d78c2954b4604fc447668470e7b72a175d4f451 100644 (file)
@@ -203,7 +203,7 @@ bool detach(void) {
 
        if(do_detach) {
 #ifndef HAVE_MINGW
 
        if(do_detach) {
 #ifndef HAVE_MINGW
-               if(daemon(0, 0)) {
+               if(daemon(1, 0)) {
                        logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
                        return false;
                }
                        logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
                        return false;
                }
index 15a5622d814ac13a8a121252ccac172637153034..3bc17e233fd34f69c77dc094f1c91499a0ccd938 100644 (file)
@@ -338,6 +338,7 @@ int main(int argc, char **argv) {
                return 1;
 
        make_names(true);
                return 1;
 
        make_names(true);
+       chdir(confbase);
 
        if(show_version) {
                printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE,
 
        if(show_version) {
                printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE,