diff options
author | Denis Vlasenko | 2006-10-14 02:23:43 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-10-14 02:23:43 +0000 |
commit | ea62077b850076c4d7dc3cf78ebd1888928c6ddf (patch) | |
tree | 37b7584ae40b99edb5583fbc4392b62ffdadf278 /libbb/procps.c | |
parent | 88ca06769028e442bf873b270c176ca0e9f021f8 (diff) | |
download | busybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.zip busybox-ea62077b850076c4d7dc3cf78ebd1888928c6ddf.tar.gz |
add open_read_close() and similar stuff
Diffstat (limited to 'libbb/procps.c')
-rw-r--r-- | libbb/procps.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 2bcd2cc..eba9070 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; } |