Replace non-portable asprintf by g_strdup_printf

g_strdup_printf already handles OOM errors, so some error handling in
QEMU code can be removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Stefan Weil 2013-01-16 18:37:23 +01:00 committed by Blue Swirl
parent 0e7a759293
commit e4ada48242
3 changed files with 9 additions and 17 deletions

8
exec.c
View file

@ -863,18 +863,16 @@ static void *file_ram_alloc(RAMBlock *block,
return NULL;
}
if (asprintf(&filename, "%s/qemu_back_mem.XXXXXX", path) == -1) {
return NULL;
}
filename = g_strdup_printf("%s/qemu_back_mem.XXXXXX", path);
fd = mkstemp(filename);
if (fd < 0) {
perror("unable to create backing store for hugepages");
free(filename);
g_free(filename);
return NULL;
}
unlink(filename);
free(filename);
g_free(filename);
memory = (memory+hpagesize-1) & ~(hpagesize-1);