Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/full_write.c')
-rw-r--r--libbb/full_write.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbb/full_write.c b/libbb/full_write.c
index 7bbacb8ac..7503c8b42 100644
--- a/libbb/full_write.c
+++ b/libbb/full_write.c
@@ -24,8 +24,14 @@ ssize_t full_write(int fd, const void *buf, size_t len)
while (len) {
cc = safe_write(fd, buf, len);
- if (cc < 0)
+ if (cc < 0) {
+ if (total) {
+ /* we already wrote some! */
+ /* user can do another write to know the error code */
+ return total;
+ }
return cc; /* write() returns -1 on failure. */
+ }
total += cc;
buf = ((const char *)buf) + cc;