diff options
-rw-r--r-- | procps/nmeter.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c index 96d0bb951..205cb8251 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c | |||
@@ -132,11 +132,10 @@ static void readfile_z(char *buf, int sz, const char* fname) | |||
132 | 132 | ||
133 | int fd = xopen(fname, O_RDONLY); | 133 | int fd = xopen(fname, O_RDONLY); |
134 | buf[0] = '\0'; | 134 | buf[0] = '\0'; |
135 | if (fd >= 0) { | 135 | sz = read(fd, buf, sz - 1); |
136 | sz = read(fd, buf, sz-1); | 136 | if (sz > 0) |
137 | if (sz > 0) buf[sz] = '\0'; | 137 | buf[sz] = '\0'; |
138 | close(fd); | 138 | close(fd); |
139 | } | ||
140 | } | 139 | } |
141 | 140 | ||
142 | static const char* get_file(proc_file *pf) | 141 | static const char* get_file(proc_file *pf) |