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

[Xen-changelog] Check the return value of chdir(2) and write(2).



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID d22091179975853b0438c937aaea239d92b83832
# Parent  219d96d545fcb918d1abc45688975af86728b408
Check the return value of chdir(2) and write(2).
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 219d96d545fc -r d22091179975 tools/console/daemon/utils.c
--- a/tools/console/daemon/utils.c      Mon Sep 12 20:00:41 2005
+++ b/tools/console/daemon/utils.c      Mon Sep 12 20:24:58 2005
@@ -105,7 +105,8 @@
        close(fd);
 
        umask(027);
-       chdir("/");
+       if (chdir("/") < 0)
+               exit (1);
 
        fd = open(pidfile, O_RDWR | O_CREAT);
        if (fd == -1) {
@@ -117,7 +118,8 @@
        }
 
        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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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