From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Limpach Subject: Re: [PATCH] error checking / gcc4 Date: Mon, 12 Sep 2005 21:25:31 +0100 Message-ID: <3d8eece2050912132540bc5c9f@mail.gmail.com> References: Reply-To: Christian.Limpach@cl.cam.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Rik van Riel Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Thanks! On 9/12/05, Rik van Riel 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 >=20 > Signed-off-by: Rik van Riel >=20 > --- 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.00000= 0000 -0400 > @@ -105,7 +105,9 @@ > close(fd); >=20 > umask(027); > - chdir("/"); > + if (chdir("/") < 0) { > + exit(1); > + } >=20 > fd =3D open(pidfile, O_RDWR | O_CREAT); > if (fd =3D=3D -1) { > @@ -117,7 +119,9 @@ > } >=20 > len =3D sprintf(buf, "%d\n", getpid()); > - write(fd, buf, len); > + if (write(fd, buf, len) < 0) { > + exit(1); > + } >=20 > signal(SIGCHLD, child_exit); > signal(SIGTSTP, SIG_IGN); >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >