summaryrefslogtreecommitdiff
path: root/networking/netstat.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-14 02:23:43 +0000
committerDenis Vlasenko2006-10-14 02:23:43 +0000
commitea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch)
tree37b7584ae40b99edb5583fbc4392b62ffdadf278 /networking/netstat.c
parent88ca06769028e442bf873b270c176ca0e9f021f8 (diff)
downloadbusybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.zip
busybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz
add open_read_close() and similar stuff
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 bc5c619..8e481f6 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -496,7 +496,6 @@ static void unix_do_one(int nr, const char *line)
static void do_info(const char *file, const char *name, void (*proc)(int, const char *))
{
- char buffer[8192];
int lnr = 0;
FILE *procinfo;
@@ -505,12 +504,15 @@ static void do_info(const char *file, const char *name, void (*proc)(int, const
if (errno != ENOENT) {
perror(file);
} else {
- bb_error_msg("no support for `%s' on this system", name);
+ bb_error_msg("no support for '%s' on this system", name);
}
} else {
do {
- if (fgets(buffer, sizeof(buffer), procinfo))
+ char *buffer = xmalloc_fgets(procinfo);
+ if (buffer) {
(proc)(lnr++, buffer);
+ free(buffer);
+ }
} while (!feof(procinfo));
fclose(procinfo);
}