aboutsummaryrefslogtreecommitdiff
path: root/networking/netstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/netstat.c')
-rw-r--r--networking/netstat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/networking/netstat.c b/networking/netstat.c
index f80b845bc..1303d3f3d 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -228,12 +228,12 @@ static long extract_socket_inode(const char *lname)
228{ 228{
229 long inode = -1; 229 long inode = -1;
230 230
231 if (strncmp(lname, "socket:[", sizeof("socket:[")-1) == 0) { 231 if (is_prefixed_with(lname, "socket:[")) {
232 /* "socket:[12345]", extract the "12345" as inode */ 232 /* "socket:[12345]", extract the "12345" as inode */
233 inode = bb_strtoul(lname + sizeof("socket:[")-1, (char**)&lname, 0); 233 inode = bb_strtoul(lname + sizeof("socket:[")-1, (char**)&lname, 0);
234 if (*lname != ']') 234 if (*lname != ']')
235 inode = -1; 235 inode = -1;
236 } else if (strncmp(lname, "[0000]:", sizeof("[0000]:")-1) == 0) { 236 } else if (is_prefixed_with(lname, "[0000]:")) {
237 /* "[0000]:12345", extract the "12345" as inode */ 237 /* "[0000]:12345", extract the "12345" as inode */
238 inode = bb_strtoul(lname + sizeof("[0000]:")-1, NULL, 0); 238 inode = bb_strtoul(lname + sizeof("[0000]:")-1, NULL, 0);
239 if (errno) /* not NUL terminated? */ 239 if (errno) /* not NUL terminated? */
@@ -622,7 +622,7 @@ static int FAST_FUNC unix_do_one(char *line)
622 622
623 /* TODO: currently we stop at first NUL byte. Is it a problem? */ 623 /* TODO: currently we stop at first NUL byte. Is it a problem? */
624 line += path_ofs; 624 line += path_ofs;
625 *strchrnul(line, '\n') = '\0'; 625 chomp(line);
626 while (*line) 626 while (*line)
627 fputc_printable(*line++, stdout); 627 fputc_printable(*line++, stdout);
628 bb_putchar('\n'); 628 bb_putchar('\n');