diff options
author | Stefan Weil <sw@weilnetz.de> | 2013-01-16 18:37:23 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2013-01-19 10:24:43 +0000 |
commit | e4ada482420175bc17d6ccb9f2af0e769da78e01 (patch) | |
tree | 957c6756ff906ba4a5927479e714228512df7e1b /qga | |
parent | 0e7a75929353b04bd2fce1be8640226883b42a10 (diff) | |
download | qemu-e4ada482420175bc17d6ccb9f2af0e769da78e01.tar.gz qemu-e4ada482420175bc17d6ccb9f2af0e769da78e01.tar.bz2 qemu-e4ada482420175bc17d6ccb9f2af0e769da78e01.zip |
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>
Diffstat (limited to 'qga')
-rw-r--r-- | qga/commands-posix.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 77f6ee7d5f..0ad73f3430 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -939,14 +939,11 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) mac_addr = (unsigned char *) &ifr.ifr_hwaddr.sa_data; - if (asprintf(&info->value->hardware_address, - "%02x:%02x:%02x:%02x:%02x:%02x", - (int) mac_addr[0], (int) mac_addr[1], - (int) mac_addr[2], (int) mac_addr[3], - (int) mac_addr[4], (int) mac_addr[5]) == -1) { - error_setg_errno(errp, errno, "failed to format MAC"); - goto error; - } + info->value->hardware_address = + g_strdup_printf("%02x:%02x:%02x:%02x:%02x:%02x", + (int) mac_addr[0], (int) mac_addr[1], + (int) mac_addr[2], (int) mac_addr[3], + (int) mac_addr[4], (int) mac_addr[5]); info->value->has_hardware_address = true; close(sock); |