Browse Source

Fix ubuntu "ignoring return value" warnings.

Rusty Russell 16 years ago
parent
commit
cd13fd5348
2 changed files with 6 additions and 2 deletions
  1. 3 1
      ccan/daemonize/daemonize.c
  2. 3 1
      ccan/daemonize/test/run.c

+ 3 - 1
ccan/daemonize/daemonize.c

@@ -24,7 +24,9 @@ bool daemonize(void)
 	/* Session leader so ^C doesn't whack us. */
 	setsid();
 	/* Move off any mount points we might be in. */
-	chdir("/");
+	if (chdir("/") != 0)
+		return false;
+
 	/* Discard our parent's old-fashioned umask prejudices. */
 	umask(0);
 	return true;

+ 3 - 1
ccan/daemonize/test/run.c

@@ -47,7 +47,9 @@ int main(int argc, char *argv[])
 		while (getppid() == pid)
 			sleep(1);
 		daemonized.ppid = getppid();
-		write(fds[1], &daemonized, sizeof(daemonized));
+		if (write(fds[1], &daemonized, sizeof(daemonized))
+		    != sizeof(daemonized))
+			exit(1);
 		exit(0);
 	}