summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2009-12-25 18:19:15 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-12-25 18:19:15 +0000
commit34ba360fda5853d97fa69af00a5d510a786d41b3 (patch)
treec5f43bac9982243593f5992367bb504b964a76fe /path.c
parentc71b5b4a9c4ee680bc48eb02386f1dc4311e0fdb (diff)
downloadqemu-34ba360fda5853d97fa69af00a5d510a786d41b3.tar.gz
qemu-34ba360fda5853d97fa69af00a5d510a786d41b3.tar.bz2
qemu-34ba360fda5853d97fa69af00a5d510a786d41b3.zip
path.c fix warning with _FORTIFY_SOURCE
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>
Diffstat (limited to 'path.c')
-rw-r--r--path.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/path.c b/path.c
index cc9e007f38..0d2bf149e4 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;
}