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] [xen-unstable] tools: Fix xenstored build error by check

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: Fix xenstored build error by checking vasprintf() return code.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Jun 2007 02:22:43 -0700
Delivery-date: Tue, 12 Jun 2007 05:06:34 -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 Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1181501902 -3600
# Node ID 93f77a5a8437df0b34919a6987f48e84342b4a43
# Parent  7eeddd787d2f8fb3cc27680d0358fe88eeaf342c
tools: Fix xenstored build error by checking vasprintf() return code.
Signed-off-by: Charles Coffing <ccoffing@xxxxxxxxxx>
---
 tools/xenstore/utils.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff -r 7eeddd787d2f -r 93f77a5a8437 tools/xenstore/utils.c
--- a/tools/xenstore/utils.c    Sun Jun 10 19:49:44 2007 +0100
+++ b/tools/xenstore/utils.c    Sun Jun 10 19:58:22 2007 +0100
@@ -27,33 +27,38 @@ void barf(const char *fmt, ...)
 void barf(const char *fmt, ...)
 {
        char *str;
+       int bytes;
        va_list arglist;
 
        xprintf("FATAL: ");
 
        va_start(arglist, fmt);
-       vasprintf(&str, fmt, arglist);
+       bytes = vasprintf(&str, fmt, arglist);
        va_end(arglist);
 
-       xprintf("%s\n", str);
-       free(str);
+       if (bytes >= 0) {
+               xprintf("%s\n", str);
+               free(str);
+       }
        exit(1);
 }
 
 void barf_perror(const char *fmt, ...)
 {
        char *str;
-       int err = errno;
+       int bytes, err = errno;
        va_list arglist;
 
        xprintf("FATAL: ");
 
        va_start(arglist, fmt);
-       vasprintf(&str, fmt, arglist);
+       bytes = vasprintf(&str, fmt, arglist);
        va_end(arglist);
 
-       xprintf("%s: %s\n", str, strerror(err));
-       free(str);
+       if (bytes >= 0) {
+               xprintf("%s: %s\n", str, strerror(err));
+               free(str);
+       }
        exit(1);
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools: Fix xenstored build error by checking vasprintf() return code., Xen patchbot-unstable <=