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] When building with FORTIFY_SOURCE to ensure that return

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] When building with FORTIFY_SOURCE to ensure that return codes of common
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Apr 2006 16:14:09 +0000
Delivery-date: Fri, 28 Apr 2006 09:15:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a8cac38001caea26608e7a67b9039bdec0a085d2
# Parent  dfdc32a9814f174fb6f4022b7598cd6a811f5e2d
When building with FORTIFY_SOURCE to ensure that return codes of common
functions are checked to avoid some bugs, a few warnings pop up and
become errors due to -Werror.  Attached checks the return codes
(or at least stores them to a dummy variable).

Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>

diff -r dfdc32a9814f -r a8cac38001ca tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Fri Apr 28 09:40:07 2006 +0100
+++ b/tools/xenstore/xenstored_core.c   Fri Apr 28 14:08:40 2006 +0100
@@ -173,7 +173,7 @@ void trace(const char *fmt, ...)
        va_list arglist;
        char *str;
        char sbuf[1024];
-       int ret;
+       int ret, dummy;
 
        if (tracefd < 0)
                return;
@@ -184,7 +184,7 @@ void trace(const char *fmt, ...)
        va_end(arglist);
 
        if (ret <= 1024) {
-               write(tracefd, sbuf, ret);
+               dummy = write(tracefd, sbuf, ret);
                return;
        }
 
@@ -192,7 +192,7 @@ void trace(const char *fmt, ...)
        va_start(arglist, fmt);
        str = talloc_vasprintf(NULL, fmt, arglist);
        va_end(arglist);
-       write(tracefd, str, strlen(str));
+       dummy = write(tracefd, str, strlen(str));
        talloc_free(str);
 }
 
@@ -238,7 +238,8 @@ static void trigger_reopen_log(int signa
 static void trigger_reopen_log(int signal __attribute__((unused)))
 {
        char c = 'A';
-       write(reopen_log_pipe[1], &c, 1);
+       int dummy;
+       dummy = write(reopen_log_pipe[1], &c, 1);
 }
 
 
@@ -1678,7 +1679,8 @@ static void write_pidfile(const char *pi
                exit(0);
 
        len = sprintf(buf, "%d\n", getpid());
-       write(fd, buf, len);
+       if (write(fd, buf, len) != len)
+               barf_perror("Writing pid file %s", pidfile);
 }
 
 /* Stevens. */
@@ -1703,7 +1705,8 @@ static void daemonize(void)
 
 #ifndef TESTING        /* Relative paths for socket names */
        /* Move off any mount points we might be in. */
-       chdir("/");
+       if (chdir("/") == -1)
+               barf_perror("Failed to chdir");
 #endif
        /* Discard our parent's old-fashioned umask prejudices. */
        umask(0);
@@ -1900,7 +1903,8 @@ int main(int argc, char *argv[])
 
                if (FD_ISSET(reopen_log_pipe[0], &inset)) {
                        char c;
-                       read(reopen_log_pipe[0], &c, 1);
+                       if (read(reopen_log_pipe[0], &c, 1) != 1)
+                               barf_perror("read failed");
                        reopen_log();
                }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] When building with FORTIFY_SOURCE to ensure that return codes of common, Xen patchbot -unstable <=