diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 20:30:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-25 20:30:24 +0000 |
commit | 394eebed6656dfc2e56a79500b602023000ac415 (patch) | |
tree | b5b5858663e7333b9624cb4f329e91ae649f3247 /libbb/read.c | |
parent | 38b8831b3201a9e44cfb156b5b8577e4f5e8d761 (diff) | |
download | busybox-w32-394eebed6656dfc2e56a79500b602023000ac415.tar.gz busybox-w32-394eebed6656dfc2e56a79500b602023000ac415.tar.bz2 busybox-w32-394eebed6656dfc2e56a79500b602023000ac415.zip |
lpd: spool mode added by Vladimir
lpr: more robust error reporting
*: introduce and use xchroot
libbb: full_read/write now will report partial data counts prior to error
isdirectory.c: style fixes
lpd_main 249 486 +237
xchroot - 29 +29
get_response_or_say_and_die 110 139 +29
full_write 52 60 +8
full_read 55 63 +8
static.newline 1 - -1
switch_root_main 404 400 -4
chpst_main 1089 1079 -10
getopt32 1370 1359 -11
chroot_main 115 101 -14
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 4/4 up/down: 311/-40) Total: 271 bytes
text data bss dec hex filename
798472 728 7484 806684 c4f1c busybox_old
798775 728 7484 806987 c504b busybox_unstripped
Diffstat (limited to 'libbb/read.c')
-rw-r--r-- | libbb/read.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbb/read.c b/libbb/read.c index 4ad41d589..575446536 100644 --- a/libbb/read.c +++ b/libbb/read.c | |||
@@ -88,8 +88,14 @@ ssize_t full_read(int fd, void *buf, size_t len) | |||
88 | while (len) { | 88 | while (len) { |
89 | cc = safe_read(fd, buf, len); | 89 | cc = safe_read(fd, buf, len); |
90 | 90 | ||
91 | if (cc < 0) | 91 | if (cc < 0) { |
92 | return cc; /* read() returns -1 on failure. */ | 92 | if (total) { |
93 | /* we already have some! */ | ||
94 | /* user can do another read to know the error code */ | ||
95 | return total; | ||
96 | } | ||
97 | return cc; /* read() returns -1 on failure. */ | ||
98 | } | ||
93 | if (cc == 0) | 99 | if (cc == 0) |
94 | break; | 100 | break; |
95 | buf = ((char *)buf) + cc; | 101 | buf = ((char *)buf) + cc; |