From patchwork Sun Dec 20 01:39:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [17/18] path.c fix warning with _FORTIFY_SOURCE X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 41503 Message-Id: <1261273167-3240-17-git-send-email-kirill@shutemov.name> To: qemu-devel@nongnu.org Cc: "Kirill A. Shutemov" Date: Sun, 20 Dec 2009 03:39:26 +0200 From: "Kirill A. Shutemov" List-Id: qemu-devel.nongnu.org CC libuser/path.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/path.c: In function 'new_entry': /usr/src/RPM/BUILD/qemu-0.11.92/path.c:49: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result make[1]: *** [path.o] Error 1 Signed-off-by: Kirill A. Shutemov --- path.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/path.c b/path.c index cc9e007..0d2bf14 100644 --- a/path.c +++ b/path.c @@ -46,7 +46,10 @@ static struct pathelem *new_entry(const char *root, { struct pathelem *new = malloc(sizeof(*new)); new->name = strdup(name); - asprintf(&new->pathname, "%s/%s", root, name); + if (asprintf(&new->pathname, "%s/%s", root, name) == -1) { + printf("Cannot allocate memory\n"); + exit(1); + } new->num_entries = 0; return new; }