提交 34ba360f 编写于 作者: K Kirill A. Shutemov 提交者: Blue Swirl

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: NKirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 c71b5b4a
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册