summaryrefslogtreecommitdiff
path: root/lib/full-write.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-01-26 18:20:04 +0000
committerJim Meyering <jim@meyering.net>1994-01-26 18:20:04 +0000
commit35b0248480191b7b187048411054d30c9142962b (patch)
treec87023f83494011e2373f723085cd1dfab129639 /lib/full-write.c
parent5629153f1eadc2b27dd48ff18a194f6819d9d732 (diff)
downloadcoreutils-35b0248480191b7b187048411054d30c9142962b.tar.xz
.
Diffstat (limited to 'lib/full-write.c')
-rw-r--r--lib/full-write.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/full-write.c b/lib/full-write.c
index 41f410d0a..cce5f0f03 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -1,4 +1,4 @@
-/* safe-write.c -- an interface to write that retries after interrupts
+/* full-write.c -- an interface to write that retries after interrupts
Copyright (C) 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,7 @@ extern int errno;
#endif
/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
- Return zero upon success, write's (negative) error code otherwise. */
+ Return LEN upon success, write's (negative) error code otherwise. */
int
full_write (desc, ptr, len)
@@ -49,6 +49,9 @@ full_write (desc, ptr, len)
char *ptr;
int len;
{
+ int total_written;
+
+ total_written = 0;
while (len > 0)
{
int written = write (desc, ptr, len);
@@ -60,8 +63,9 @@ full_write (desc, ptr, len)
#endif
return written;
}
+ total_written += written;
ptr += written;
len -= written;
}
- return 0;
+ return total_written;
}