WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Check the return value of chdir(2) and write(2).
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Sep 2005 20:26:10 +0000
Delivery-date: Mon, 12 Sep 2005 20:24:38 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Check the return value of chdir(2) and write(2)., Xen patchbot -unstable <=