changeset 181:983c0e170fc4

.
author Jim Meyering <jim@meyering.net>
date Wed, 26 Jan 1994 18:20:04 +0000
parents 1581a8a97f61
children 83507c652f09
files lib/Makefile.in lib/full-write.c
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -33,18 +33,18 @@
 
 SOURCES = getdate.y posixtm.y \
 argmatch.c backupfile.c basename.c dirname.c eaccess.c \
-error.c filemode.c fsusage.c getopt.c getopt1.c \
+error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
 getversion.c idcache.c isdir.c makepath.c \
-modechange.c mountlist.c savedir.c \
+modechange.c mountlist.c safe-read.c savedir.c \
 stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
 fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c stpcpy.c \
 strdup.c strstr.c alloca.c
 
 OBJECTS = getdate.o posixtm.o \
 argmatch.o backupfile.o basename.o dirname.o eaccess.o \
-error.o filemode.o getopt.o getopt1.o \
+error.o filemode.o full-write.o getopt.o getopt1.o \
 getversion.o idcache.o isdir.o makepath.o \
-modechange.o savedir.o \
+modechange.o safe-read.o savedir.o \
 stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
 @LIBOBJS@ @ALLOCA@
 
--- 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,14 +41,17 @@
 #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
-safe_write (desc, ptr, len)
+full_write (desc, ptr, len)
      int desc;
      char *ptr;
      int len;
 {
+  int total_written;
+
+  total_written = 0;
   while (len > 0)
     {
       int written = write (desc, ptr, len);
@@ -60,8 +63,9 @@
 #endif
 	  return written;
 	}
+      total_written += written;
       ptr += written;
       len -= written;
     }
-  return 0;
+  return total_written;
 }