aboutsummaryrefslogtreecommitdiffstats
path: root/capture
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-04-30 03:18:25 -0700
committerGuy Harris <gharris@sonic.net>2021-04-30 03:19:19 -0700
commit57a1514ac74527651ad42dca3041f3f53509317e (patch)
treea69a01eaeac3d625a5312930fa81f0a3c6b12e96 /capture
parent09147397007c5456fd5acd4794b5ba15330bdad3 (diff)
Cast away the return value of g_strlcpy() and g_strlcat().
Most of the time, the return value tells us nothing useful, as we've already decided that we're perfectly willing to live with string truncation. Hopefully this keeps Coverity from whining that those routines could return an error code (NARRATOR: They don't) and thus that we're ignoring the possibility of failure (as indicated, we've already decided that we can live with string truncation, so truncation is *NOT* a failure).
Diffstat (limited to 'capture')
-rw-r--r--capture/capture-pcap-util.c12
-rw-r--r--capture/ws80211_utils.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/capture/capture-pcap-util.c b/capture/capture-pcap-util.c
index 5f8377a688..3dc6c9d181 100644
--- a/capture/capture-pcap-util.c
+++ b/capture/capture-pcap-util.c
@@ -292,7 +292,7 @@ if_info_get(const char *name)
* Get the description for the interface.
*/
memset(&ifrdesc, 0, sizeof ifrdesc);
- g_strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name);
+ (void) g_strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s >= 0) {
#ifdef __FreeBSD__
@@ -1138,7 +1138,7 @@ is_linux_bonding_device(const char *ifname)
return FALSE;
memset(&ifr, 0, sizeof ifr);
- g_strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name);
+ (void) g_strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name);
memset(&ifb, 0, sizeof ifb);
ifr.ifr_data = (caddr_t)&ifb;
#if defined(SIOCBONDINFOQUERY)
@@ -1329,7 +1329,7 @@ open_capture_device_pcap_create(
*/
if (status == PCAP_ERROR) {
*open_err = CAP_DEVICE_OPEN_ERR_NOT_PERMISSIONS;
- g_strlcpy(*open_err_str, pcap_geterr(pcap_h),
+ (void) g_strlcpy(*open_err_str, pcap_geterr(pcap_h),
sizeof *open_err_str);
pcap_close(pcap_h);
return NULL;
@@ -1353,14 +1353,14 @@ open_capture_device_pcap_create(
/* Failed to activate, set to NULL */
if (status == PCAP_ERROR) {
*open_err = CAP_DEVICE_OPEN_ERR_GENERIC;
- g_strlcpy(*open_err_str, pcap_geterr(pcap_h),
+ (void) g_strlcpy(*open_err_str, pcap_geterr(pcap_h),
sizeof *open_err_str);
} else {
if (status == PCAP_ERROR_PERM_DENIED)
*open_err = CAP_DEVICE_OPEN_ERR_PERMISSIONS;
else
*open_err = CAP_DEVICE_OPEN_ERR_NOT_PERMISSIONS;
- g_strlcpy(*open_err_str, pcap_statustostr(status),
+ (void) g_strlcpy(*open_err_str, pcap_statustostr(status),
sizeof *open_err_str);
}
pcap_close(pcap_h);
@@ -1592,7 +1592,7 @@ open_capture_device(capture_options *capture_opts,
* no error message is filled in on a
* failure to open an rpcap: URL.
*/
- g_strlcpy(*open_err_str,
+ (void) g_strlcpy(*open_err_str,
"Unknown error (pcap bug; actual error cause not reported)",
sizeof *open_err_str);
}
diff --git a/capture/ws80211_utils.c b/capture/ws80211_utils.c
index 6c34b8e929..ccb690469a 100644
--- a/capture/ws80211_utils.c
+++ b/capture/ws80211_utils.c
@@ -466,7 +466,7 @@ static int get_freq_wext(const char *ifname)
if (fd == -1)
return -1;
- g_strlcpy(wrq.name1, ifname, IFNAMSIZ);
+ (void) g_strlcpy(wrq.name1, ifname, IFNAMSIZ);
/* SIOCGIWFREQ */
if (ioctl(fd, 0x8B05, &wrq) == 0) {
if (wrq.e == 6)
@@ -699,7 +699,7 @@ static int ws80211_iface_up(const char *ifname)
if (sock == -1)
return -1;
- g_strlcpy(ifreq.ifr_name, ifname, sizeof(ifreq.ifr_name));
+ (void) g_strlcpy(ifreq.ifr_name, ifname, sizeof(ifreq.ifr_name));
if (ioctl(sock, SIOCGIFFLAGS, &ifreq))
goto out_err;