Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
[libguestfs.git] / daemon / guestfsd.c
index 2e83b9f..7eabbd4 100644 (file)
@@ -160,6 +160,9 @@ main (int argc, char *argv[])
   setenv ("SHELL", "/bin/sh", 1);
   setenv ("LANG", "C", 1);
 
+  /* We document that umask defaults to 022 (it should be this anyway). */
+  umask (022);
+
   /* Resolve the hostname. */
   memset (&hints, 0, sizeof hints);
   hints.ai_socktype = SOCK_STREAM;
@@ -453,7 +456,8 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv)
 {
   int so_size = 0, se_size = 0;
   int so_fd[2], se_fd[2];
-  int pid, r, quit, i;
+  pid_t pid;
+  int r, quit, i;
   fd_set rset, rset2;
   char buf[256];
   char *p;
@@ -589,7 +593,10 @@ commandrv (char **stdoutput, char **stderror, char * const* const argv)
   }
 
   /* Get the exit status of the command. */
-  waitpid (pid, &r, 0);
+  if (waitpid (pid, &r, 0) != pid) {
+    perror ("waitpid");
+    return -1;
+  }
 
   if (WIFEXITED (r)) {
     return WEXITSTATUS (r);