[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] error checking / gcc4


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Rik van Riel <riel@xxxxxxxxxx>
  • Date: Mon, 12 Sep 2005 16:20:49 -0400 (EDT)
  • Delivery-date: Mon, 12 Sep 2005 20:19:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

There are a few more places where gcc4 complains about not
checking the return value of certain calls.  This trivial
patch adds error checking to tools/console/daemon/utils.c

Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>

--- xen-unstable/tools/console/daemon/utils.c.gcc4      2005-09-07 
11:14:24.000000000 -0400
+++ xen-unstable/tools/console/daemon/utils.c   2005-09-07 11:16:21.000000000 
-0400
@@ -105,7 +105,9 @@
        close(fd);
 
        umask(027);
-       chdir("/");
+       if (chdir("/") < 0) {
+               exit(1);
+       }
 
        fd = open(pidfile, O_RDWR | O_CREAT);
        if (fd == -1) {
@@ -117,7 +119,9 @@
        }
 
        len = sprintf(buf, "%d\n", getpid());
-       write(fd, buf, len);
+       if (write(fd, buf, len) < 0) {
+               exit(1);
+       }
 
        signal(SIGCHLD, child_exit);
        signal(SIGTSTP, SIG_IGN);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.