aboutsummaryrefslogtreecommitdiff
path: root/networking/netstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/netstat.c')
-rw-r--r--networking/netstat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/networking/netstat.c b/networking/netstat.c
index bc5c61974..8e481f67b 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -496,7 +496,6 @@ static void unix_do_one(int nr, const char *line)
496 496
497static void do_info(const char *file, const char *name, void (*proc)(int, const char *)) 497static void do_info(const char *file, const char *name, void (*proc)(int, const char *))
498{ 498{
499 char buffer[8192];
500 int lnr = 0; 499 int lnr = 0;
501 FILE *procinfo; 500 FILE *procinfo;
502 501
@@ -505,12 +504,15 @@ static void do_info(const char *file, const char *name, void (*proc)(int, const
505 if (errno != ENOENT) { 504 if (errno != ENOENT) {
506 perror(file); 505 perror(file);
507 } else { 506 } else {
508 bb_error_msg("no support for `%s' on this system", name); 507 bb_error_msg("no support for '%s' on this system", name);
509 } 508 }
510 } else { 509 } else {
511 do { 510 do {
512 if (fgets(buffer, sizeof(buffer), procinfo)) 511 char *buffer = xmalloc_fgets(procinfo);
512 if (buffer) {
513 (proc)(lnr++, buffer); 513 (proc)(lnr++, buffer);
514 free(buffer);
515 }
514 } while (!feof(procinfo)); 516 } while (!feof(procinfo));
515 fclose(procinfo); 517 fclose(procinfo);
516 } 518 }