aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-util-unix.c
diff options
context:
space:
mode:
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-08 18:50:39 +0000
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>2005-08-08 18:50:39 +0000
commitd615067ecfe859cadfb09c0896864a4bff299d4f (patch)
treeae44175ca8fd23548fcec5833098b535af5e372c /pcap-util-unix.c
parentb5ff280c656047376ee397671794e3b15e7ac3ae (diff)
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 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15264 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'pcap-util-unix.c')
-rw-r--r--pcap-util-unix.c9
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;
}