summaryrefslogtreecommitdiff
path: root/libbb/full_read.c
diff options
context:
space:
mode:
authorManuel Novoa III2003-03-19 09:13:01 +0000
committerManuel Novoa III2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /libbb/full_read.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
busybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
Major coreutils update.
Diffstat (limited to 'libbb/full_read.c')
-rw-r--r--libbb/full_read.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libbb/full_read.c b/libbb/full_read.c
index ccf26fc..e75f967 100644
--- a/libbb/full_read.c
+++ b/libbb/full_read.c
@@ -23,17 +23,16 @@
#include <unistd.h>
#include "libbb.h"
-
/*
* Read all of the supplied buffer from a file.
* This does multiple reads as necessary.
* Returns the amount read, or -1 on an error.
* A short read is returned on an end of file.
*/
-int full_read(int fd, char *buf, int len)
+ssize_t bb_full_read(int fd, void *buf, size_t len)
{
- int cc;
- int total;
+ ssize_t cc;
+ ssize_t total;
total = 0;
@@ -41,12 +40,12 @@ int full_read(int fd, char *buf, int len)
cc = read(fd, buf, len);
if (cc < 0)
- return -1;
+ return cc; /* read() returns -1 on failure. */
if (cc == 0)
break;
- buf += cc;
+ buf = ((char *)buf) + cc;
total += cc;
len -= cc;
}