From: Kirill A. Shutemov Date: Fri, 25 Dec 2009 18:19:15 +0000 (+0000) Subject: path.c fix warning with _FORTIFY_SOURCE X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~9173 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34ba360fda5853d97fa69af00a5d510a786d41b3;p=sdk%2Femulator%2Fqemu.git 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 Signed-off-by: Blue Swirl --- 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; }