Actually go daemon
authorWouter Verhelst <w@uter.be>
Tue, 26 May 2009 15:45:19 +0000 (17:45 +0200)
committerWouter Verhelst <w@uter.be>
Tue, 26 May 2009 15:45:19 +0000 (17:45 +0200)
just doing chdir("/") leave file descriptors open, which is not ideal.
Doing it this way closes everything, including any system-specific
things we're not aware of.

nbd-client.c

index 13f0dde..913af90 100644 (file)
@@ -316,7 +316,7 @@ int main(int argc, char *argv[]) {
 
        /* Go daemon */
        
-       chdir("/");
+       daemon(0,0);
        do {
 #ifndef NOFORK
                if (!nofork) {