diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-14 02:23:43 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-14 02:23:43 +0000 |
commit | 9e617927e057d79ceb2ac4869b18b1e84567dc68 (patch) | |
tree | 37b7584ae40b99edb5583fbc4392b62ffdadf278 /libbb/procps.c | |
parent | 6147e0907e5b5e3a07a4c8976097a585faaa3895 (diff) | |
download | busybox-w32-9e617927e057d79ceb2ac4869b18b1e84567dc68.tar.gz busybox-w32-9e617927e057d79ceb2ac4869b18b1e84567dc68.tar.bz2 busybox-w32-9e617927e057d79ceb2ac4869b18b1e84567dc68.zip |
add open_read_close() and similar stuff
git-svn-id: svn://busybox.net/trunk/busybox@16377 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 | ||