diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-14 02:23:43 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-14 02:23:43 +0000 |
commit | ea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch) | |
tree | 37b7584ae40b99edb5583fbc4392b62ffdadf278 /networking/netstat.c | |
parent | 88ca06769028e442bf873b270c176ca0e9f021f8 (diff) | |
download | busybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz busybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.bz2 busybox-w32-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.zip |
add open_read_close() and similar stuff
Diffstat (limited to 'networking/netstat.c')
-rw-r--r-- | networking/netstat.c | 8 |
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 | ||
497 | static void do_info(const char *file, const char *name, void (*proc)(int, const char *)) | 497 | static 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 | } |