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 /libbb/procps.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 '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 2bcd2cced..eba90705c 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -22,15 +22,9 @@ | |||
22 | 22 | ||
23 | static int read_to_buf(const char *filename, void *buf) | 23 | static int read_to_buf(const char *filename, void *buf) |
24 | { | 24 | { |
25 | int fd; | ||
26 | ssize_t ret; | 25 | ssize_t ret; |
27 | 26 | ret = open_read_close(filename, buf, PROCPS_BUFSIZE-1); | |
28 | fd = open(filename, O_RDONLY); | 27 | ((char *)buf)[ret > 0 ? ret : 0] = '\0'; |
29 | if (fd < 0) | ||
30 | return -1; | ||
31 | ret = read(fd, buf, PROCPS_BUFSIZE-1); | ||
32 | ((char *)buf)[ret > 0 ? ret : 0] = 0; | ||
33 | close(fd); | ||
34 | return ret; | 28 | return ret; |
35 | } | 29 | } |
36 | 30 | ||