daemonize: make valgrind happy.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 6 Jan 2011 01:45:03 +0000 (12:15 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 6 Jan 2011 01:45:03 +0000 (12:15 +1030)
ccan/daemonize/test/run.c

index a471268d3ef172995fd4a0088cd70c9266c75383..c86f214bcae6e3fcfb2901e436971471e21e2479 100644 (file)
@@ -5,6 +5,7 @@
 #include <unistd.h>
 #include <err.h>
 #include <errno.h>
+#include <string.h>
 
 struct child_data {
        pid_t pid;
@@ -34,6 +35,8 @@ int main(int argc, char *argv[])
                char buffer[2];
                pid = getpid();
                daemonize();
+               /* Keep valgrind happy about uninitialized bytes. */
+               memset(&daemonized, 0, sizeof(daemonized));
                daemonized.pid = getpid();
                daemonized.in_root_dir = (getcwd(buffer, 2) != NULL);
                daemonized.read_from_stdin