aboutsummaryrefslogtreecommitdiff
path: root/networking/netstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/netstat.c')
-rw-r--r--networking/netstat.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/networking/netstat.c b/networking/netstat.c
index 29c2384a4..348abd8ad 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -349,13 +349,9 @@ static int unix_do_one(int nr, char *line)
349 const char *ss_proto, *ss_state, *ss_type; 349 const char *ss_proto, *ss_state, *ss_type;
350 char ss_flags[32]; 350 char ss_flags[32];
351 351
352 /* TODO: currently we stop at first NUL byte. Is it a problem? */
353
354 if (nr == 0) 352 if (nr == 0)
355 return 0; /* skip header */ 353 return 0; /* skip header */
356 354
357 *strchrnul(line, '\n') = '\0';
358
359 /* 2.6.15 may report lines like "... @/tmp/fam-user-^@^@^@^@^@^@^@..." 355 /* 2.6.15 may report lines like "... @/tmp/fam-user-^@^@^@^@^@^@^@..."
360 * Other users report long lines filled by NUL bytes. 356 * Other users report long lines filled by NUL bytes.
361 * (those ^@ are NUL bytes too). We see them as empty lines. */ 357 * (those ^@ are NUL bytes too). We see them as empty lines. */
@@ -443,9 +439,16 @@ static int unix_do_one(int nr, char *line)
443 strcat(ss_flags, "N "); 439 strcat(ss_flags, "N ");
444 strcat(ss_flags, "]"); 440 strcat(ss_flags, "]");
445 441
446 printf("%-5s %-6ld %-11s %-10s %-13s %6lu %s\n", 442 printf("%-5s %-6ld %-11s %-10s %-13s %6lu ",
447 ss_proto, refcnt, ss_flags, ss_type, ss_state, inode, 443 ss_proto, refcnt, ss_flags, ss_type, ss_state, inode
448 line + path_ofs); 444 );
445
446 /* TODO: currently we stop at first NUL byte. Is it a problem? */
447 line += path_ofs;
448 *strchrnul(line, '\n') = '\0';
449 while (*line)
450 fputc_printable(*line++, stdout);
451 bb_putchar('\n');
449 return 0; 452 return 0;
450} 453}
451 454