diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
commit | 0dc9fb3d4ab00d14bf45c597471e10e601efd4d4 (patch) | |
tree | ae44175ca8fd23548fcec5833098b535af5e372c /pcap-util-unix.c | |
parent | f3407856f4fd97caf90655205cdb2c66991e75ba (diff) | |
download | wireshark-0dc9fb3d4ab00d14bf45c597471e10e601efd4d4.tar.gz |
various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants
svn path=/trunk/; revision=15264
Diffstat (limited to 'pcap-util-unix.c')
-rw-r--r-- | pcap-util-unix.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pcap-util-unix.c b/pcap-util-unix.c index ae14754aba..9f4a6798d7 100644 --- a/pcap-util-unix.c +++ b/pcap-util-unix.c @@ -93,7 +93,7 @@ get_interface_list(int *err, char *err_str) if (sock < 0) { *err = CANT_GET_INTERFACE_LIST; - sprintf(err_str, "Error opening socket: %s", + g_snprintf(err_str, PCAP_ERRBUF_SIZE, "Error opening socket: %s", strerror(errno)); return NULL; } @@ -111,14 +111,14 @@ get_interface_list(int *err, char *err_str) memset (buf, 0, len); if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) { if (errno != EINVAL || lastlen != 0) { - sprintf(err_str, + g_snprintf(err_str, PCAP_ERRBUF_SIZE, "SIOCGIFCONF ioctl error getting list of interfaces: %s", strerror(errno)); goto fail; } } else { if ((unsigned) ifc.ifc_len < sizeof(struct ifreq)) { - sprintf(err_str, + g_snprintf(err_str, PCAP_ERRBUF_SIZE, "SIOCGIFCONF ioctl gave too small return buffer"); goto fail; } @@ -165,7 +165,8 @@ get_interface_list(int *err, char *err_str) if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifrflags) < 0) { if (errno == ENXIO) goto next; - sprintf(err_str, "SIOCGIFFLAGS error getting flags for interface %s: %s", + g_snprintf(err_str, PCAP_ERRBUF_SIZE, + "SIOCGIFFLAGS error getting flags for interface %s: %s", ifr->ifr_name, strerror(errno)); goto fail; } |