* [PATCH] error checking / gcc4
@ 2005-09-12 20:20 Rik van Riel
2005-09-12 20:25 ` Christian Limpach
0 siblings, 1 reply; 2+ messages in thread
From: Rik van Riel @ 2005-09-12 20:20 UTC (permalink / raw)
To: xen-devel
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@redhat.com>
--- 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);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] error checking / gcc4
2005-09-12 20:20 [PATCH] error checking / gcc4 Rik van Riel
@ 2005-09-12 20:25 ` Christian Limpach
0 siblings, 0 replies; 2+ messages in thread
From: Christian Limpach @ 2005-09-12 20:25 UTC (permalink / raw)
To: Rik van Riel; +Cc: xen-devel
Thanks!
On 9/12/05, Rik van Riel <riel@redhat.com> wrote:
> 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@redhat.com>
>
> --- 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@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-12 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-12 20:20 [PATCH] error checking / gcc4 Rik van Riel
2005-09-12 20:25 ` Christian Limpach
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.