From: "Charles Coffing" Subject: [PATCH] fix xenstored build error Date: Fri, 08 Jun 2007 16:47:43 -0400 Message-ID: <46696ADC.D169.003C.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartF8DFDA7F.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__PartF8DFDA7F.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline tools/xenstore/Makefile includes -Werror, so warnings are fatal. I just hit this: gcc -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -Werror -Wp,-MD,.utils.o.d -I../../tools/libxc -I. -c -o utils.o utils.c cc1: warnings being treated as errors utils.c: In function 'barf': utils.c:35: warning: ignoring return value of 'vasprintf', declared with attribute warn_unused_result utils.c: In function 'barf_perror': utils.c:52: warning: ignoring return value of 'vasprintf', declared with attribute warn_unused_result Indeed, if vasprintf fails to allocate memory, then the process could crash. (True, this is on an exit path anyway, but crashing is nevertheless poor manners...) The attached patch handles failed allocations more gracefully, which in turn allows my builds to complete. Please apply to xen-unstable. Signed-off-by: Charles Coffing --=__PartF8DFDA7F.0__= Content-Type: application/octet-stream; name="xenstored-warnings.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xenstored-warnings.diff" LS0tIHhlbi0zLjEtdGVzdGluZy5vcmlnL3Rvb2xzL3hlbnN0b3JlL3V0aWxzLmMKKysrIHhlbi0z LjEtdGVzdGluZy90b29scy94ZW5zdG9yZS91dGlscy5jCkBAIC0yNywzMyArMjcsMzggQEAgdm9p ZCB4cHJpbnRmKGNvbnN0IGNoYXIgKmZtdCwgLi4uKQogdm9pZCBiYXJmKGNvbnN0IGNoYXIgKmZt dCwgLi4uKQogewogCWNoYXIgKnN0cjsKKwlpbnQgYnl0ZXM7CiAJdmFfbGlzdCBhcmdsaXN0Owog CiAJeHByaW50ZigiRkFUQUw6ICIpOwogCiAJdmFfc3RhcnQoYXJnbGlzdCwgZm10KTsKLQl2YXNw cmludGYoJnN0ciwgZm10LCBhcmdsaXN0KTsKKwlieXRlcyA9IHZhc3ByaW50Zigmc3RyLCBmbXQs IGFyZ2xpc3QpOwogCXZhX2VuZChhcmdsaXN0KTsKIAotCXhwcmludGYoIiVzXG4iLCBzdHIpOwot CWZyZWUoc3RyKTsKKyAJaWYgKGJ5dGVzID49IDApIHsKKwkJeHByaW50ZigiJXNcbiIsIHN0cik7 CisJCWZyZWUoc3RyKTsKKwl9CiAJZXhpdCgxKTsKIH0KIAogdm9pZCBiYXJmX3BlcnJvcihjb25z dCBjaGFyICpmbXQsIC4uLikKIHsKIAljaGFyICpzdHI7Ci0JaW50IGVyciA9IGVycm5vOworCWlu dCBieXRlcywgZXJyID0gZXJybm87CiAJdmFfbGlzdCBhcmdsaXN0OwogCiAJeHByaW50ZigiRkFU QUw6ICIpOwogCiAJdmFfc3RhcnQoYXJnbGlzdCwgZm10KTsKLQl2YXNwcmludGYoJnN0ciwgZm10 LCBhcmdsaXN0KTsKKwlieXRlcyA9IHZhc3ByaW50Zigmc3RyLCBmbXQsIGFyZ2xpc3QpOwogCXZh X2VuZChhcmdsaXN0KTsKIAotCXhwcmludGYoIiVzOiAlc1xuIiwgc3RyLCBzdHJlcnJvcihlcnIp KTsKLQlmcmVlKHN0cik7CisgCWlmIChieXRlcyA+PSAwKSB7CisJCXhwcmludGYoIiVzOiAlc1xu Iiwgc3RyLCBzdHJlcnJvcihlcnIpKTsKKwkJZnJlZShzdHIpOworCX0KIAlleGl0KDEpOwogfQog Cg== --=__PartF8DFDA7F.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartF8DFDA7F.0__=--