aboutsummaryrefslogtreecommitdiff
path: root/miscutils/nmeter.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/nmeter.c')
-rw-r--r--miscutils/nmeter.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c
index e83de38ec..d71bd6add 100644
--- a/miscutils/nmeter.c
+++ b/miscutils/nmeter.c
@@ -88,12 +88,7 @@ static void put_question_marks(int count)
88 88
89static int readfile_z(char *buf, int sz, const char* fname) 89static int readfile_z(char *buf, int sz, const char* fname)
90{ 90{
91 int fd; 91 sz = open_read_close(fname, buf, sz-1);
92 fd = xopen(fname, O_RDONLY);
93 // We are not checking for short reads (valid only because
94 // we are reading /proc files)
95 sz = read(fd, buf, sz-1);
96 close(fd);
97 if (sz < 0) { 92 if (sz < 0) {
98 buf[0] = '\0'; 93 buf[0] = '\0';
99 return 1; 94 return 1;
@@ -776,15 +771,12 @@ int nmeter_main(int argc, char* argv[])
776 s_stat *last = NULL; 771 s_stat *last = NULL;
777 s_stat *s; 772 s_stat *s;
778 char *cur, *prev; 773 char *cur, *prev;
779 int fd;
780 774
781 if (argc != 2) 775 if (argc != 2)
782 bb_show_usage(); 776 bb_show_usage();
783 777
784 fd = xopen("/proc/version", O_RDONLY); 778 if (open_read_close("/proc/version", buf, sizeof(buf)) > 0)
785 if (read(fd, buf, sizeof(buf)) > 0) 779 is26 = (strstr(buf, " 2.4.")==NULL);
786 is26 = (strstr(buf, "Linux version 2.4.")==NULL);
787 close(fd);
788 780
789 // Can use argv[1] directly, but this will mess up 781 // Can use argv[1] directly, but this will mess up
790 // parameters as seen by e.g. ps. Making a copy... 782 // parameters as seen by e.g. ps. Making a copy...