From 72a87713f060b98fd8dfa16032df617dd250fa08 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Thu, 4 Mar 2010 23:11:23 -0300
Subject: [PATCH 01/42] path.c fix warning with _FORTIFY_SOURCE

RH-Author: Juan Quintela <quintela@redhat.com>
Message-id: <25cafa2c531cccf3dde886206a8aa6a9d761636d.1267743950.git.quintela@redhat.com>
Patchwork-id: 7530
O-Subject: [PATCH 01/32] path.c fix warning with _FORTIFY_SOURCE
Bugzilla: 567099
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>

From: Kirill A. Shutemov <kirill@shutemov.name>

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 <kirill@shutemov.name>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 34ba360fda5853d97fa69af00a5d510a786d41b3)

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 path.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 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;
 }
-- 
1.6.3.rc4.29.g8146

