diff options
author | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-09-12 20:24:58 +0000 |
---|---|---|
committer | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-09-12 20:24:58 +0000 |
commit | 84592bf97c218c5e8cf6ac9ca120a72692dbe193 (patch) | |
tree | 3da8c5443c34e186d76a187beea3f6c4e9038683 /tools/console | |
parent | d75b89f0b55cdbf55a20997e38b54231fcd8b3af (diff) | |
download | xen-84592bf97c218c5e8cf6ac9ca120a72692dbe193.tar.gz xen-84592bf97c218c5e8cf6ac9ca120a72692dbe193.tar.bz2 xen-84592bf97c218c5e8cf6ac9ca120a72692dbe193.zip |
Check the return value of chdir(2) and write(2).
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/console')
-rw-r--r-- | tools/console/daemon/utils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/console/daemon/utils.c b/tools/console/daemon/utils.c index 985de2061a..3372632737 100644 --- a/tools/console/daemon/utils.c +++ b/tools/console/daemon/utils.c @@ -105,7 +105,8 @@ void daemonize(const char *pidfile) close(fd); umask(027); - chdir("/"); + if (chdir("/") < 0) + exit (1); fd = open(pidfile, O_RDWR | O_CREAT); if (fd == -1) { @@ -117,7 +118,8 @@ void daemonize(const char *pidfile) } 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); |