summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2014-01-07 15:59:33 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2014-01-07 15:59:33 +0000
commit50da3e886ddff447655ed582d9a68ef861890125 (patch)
treeefc014a0ef02ce8ce0cdc44797ad3f3207a73316 /sys
parentfdac1e8bdc6e78698e1e22b975d338f2c6316547 (diff)
downloadsrc-test2-50da3e886ddff447655ed582d9a68ef861890125.tar.gz
src-test2-50da3e886ddff447655ed582d9a68ef861890125.zip
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/firewire/if_fwe.c10
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/if_tap.c8
-rw-r--r--sys/net/if_tun.c4
4 files changed, 10 insertions, 16 deletions
diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c
index e6abebdab527..a7d9bc35d494 100644
--- a/sys/dev/firewire/if_fwe.c
+++ b/sys/dev/firewire/if_fwe.c
@@ -403,7 +403,7 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
struct ifstat *ifs = NULL;
- int s, error, len;
+ int s, error;
switch (cmd) {
case SIOCSIFFLAGS:
@@ -434,12 +434,8 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCGIFSTATUS:
s = splimp();
ifs = (struct ifstat *)data;
- len = strlen(ifs->ascii);
- if (len < sizeof(ifs->ascii))
- snprintf(ifs->ascii + len,
- sizeof(ifs->ascii) - len,
- "\tch %d dma %d\n",
- fwe->stream_ch, fwe->dma_ch);
+ snprintf(ifs->ascii, sizeof(ifs->ascii),
+ "\tch %d dma %d\n", fwe->stream_ch, fwe->dma_ch);
splx(s);
break;
case SIOCSIFCAP:
diff --git a/sys/net/if.c b/sys/net/if.c
index f190bb47d26a..e0ef442152d7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2088,7 +2088,6 @@ static int
ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
{
struct ifreq *ifr;
- struct ifstat *ifs;
int error = 0;
int new_flags, temp_flags;
size_t namelen, onamelen;
@@ -2425,9 +2424,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
break;
case SIOCGIFSTATUS:
- ifs = (struct ifstat *)data;
- ifs->ascii[0] = '\0';
-
case SIOCGIFPSRCADDR:
case SIOCGIFPDSTADDR:
case SIOCGIFMEDIA:
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 5153b2adbc4d..d788635a59e1 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -636,12 +636,12 @@ tapifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCGIFSTATUS:
ifs = (struct ifstat *)data;
- dummy = strlen(ifs->ascii);
mtx_lock(&tp->tap_mtx);
- if (tp->tap_pid != 0 && dummy < sizeof(ifs->ascii))
- snprintf(ifs->ascii + dummy,
- sizeof(ifs->ascii) - dummy,
+ if (tp->tap_pid != 0)
+ snprintf(ifs->ascii, sizeof(ifs->ascii),
"\tOpened by PID %d\n", tp->tap_pid);
+ else
+ ifs->ascii[0] = '\0';
mtx_unlock(&tp->tap_mtx);
break;
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index ddef6f90d207..45e10c1c649f 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -546,8 +546,10 @@ tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifs = (struct ifstat *)data;
mtx_lock(&tp->tun_mtx);
if (tp->tun_pid)
- sprintf(ifs->ascii + strlen(ifs->ascii),
+ snprintf(ifs->ascii, sizeof(ifs->ascii),
"\tOpened by PID %d\n", tp->tun_pid);
+ else
+ ifs->ascii[0] = '\0';
mtx_unlock(&tp->tun_mtx);
break;
case SIOCSIFADDR: