]> git.ozlabs.org Git - ccan/blobdiff - ccan/daemon-with-notify/test/run.c
fix up daemon-with-notify test
[ccan] / ccan / daemon-with-notify / test / run.c
index 9bb966da240b722e33dd29f9ea4cfc399f159b5d..70ccfbbecdcbd9605b1105432a477d8995436a7e 100644 (file)
@@ -1,5 +1,5 @@
-#include <ccan/daemonize/daemonize.h>
-#include <ccan/daemonize/daemonize.c>
+#include <ccan/daemon-with-notify/daemon-with-notify.h>
+#include <ccan/daemon-with-notify/daemon-with-notify.c>
 #include <ccan/tap/tap.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -10,7 +10,7 @@
 struct child_data {
        pid_t pid;
        pid_t ppid;
-       bool in_root_dir;
+       int in_root_dir;
        int read_from_stdin, write_to_stdout, write_to_stderr;
 };
 
@@ -34,7 +34,8 @@ int main(int argc, char *argv[])
        if (pid == 0) {
                char buffer[2];
                pid = getpid();
-               daemonize();
+               daemonize(0, 0, 1);
+               daemon_is_ready();
                /* Keep valgrind happy about uninitialized bytes. */
                memset(&daemonized, 0, sizeof(daemonized));
                daemonized.pid = getpid();
@@ -66,8 +67,8 @@ int main(int argc, char *argv[])
        ok1(daemonized.pid != pid);
        ok1(daemonized.ppid == 1);
        ok1(daemonized.in_root_dir);
-       ok1(daemonized.read_from_stdin == EBADF);
-       ok1(daemonized.write_to_stdout == EBADF);
+       ok1(daemonized.read_from_stdin == 0);
+       ok1(daemonized.write_to_stdout == 0);
        ok1(daemonized.write_to_stderr == 0);
 
        return exit_status();