aboutsummaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 2bcd2cced..eba90705c 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -22,15 +22,9 @@
static int read_to_buf(const char *filename, void *buf)
{
- int fd;
ssize_t ret;
-
- fd = open(filename, O_RDONLY);
- if (fd < 0)
- return -1;
- ret = read(fd, buf, PROCPS_BUFSIZE-1);
- ((char *)buf)[ret > 0 ? ret : 0] = 0;
- close(fd);
+ ret = open_read_close(filename, buf, PROCPS_BUFSIZE-1);
+ ((char *)buf)[ret > 0 ? ret : 0] = '\0';
return ret;
}