Fix bug 424: doing full_read breaks things like cat which should return a

chunk of data when they get it and not block until they've buffered 4k.

The use case was cat /proc/psaux, but you can also reproduce this by
running non-busybox cat by itself and typing things at the command line.
Then run busybox cat.  Notice how cat is _supposed_ to echo each line back
to us as we hit enter?
This commit is contained in:
Rob Landley 2005-11-04 01:54:15 +00:00
parent 21ccbb6c0e
commit 3fc4ad1478

View File

@ -33,7 +33,7 @@ static ssize_t bb_full_fd_action(int src_fd, int dst_fd, size_t size)
while (!size || total < size)
{
ssize_t wrote, xread = (size && size < BUFSIZ) ? size : BUFSIZ;
xread = bb_full_read(src_fd, buffer, xread);
xread = safe_read(src_fd, buffer, xread);
if (xread > 0) {
/* A -1 dst_fd means we need to fake it... */
wrote = (dst_fd < 0) ? xread : bb_full_write(dst_fd, buffer, xread);