# HG changeset patch # User Jim Meyering # Date 759608404 0 # Node ID 983c0e170fc4be12808eba927da76d25441b251c # Parent 1581a8a97f615195d4cfe8df2f93f57d05343d68 . diff --git a/lib/Makefile.in b/lib/Makefile.in --- 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@ diff --git a/lib/full-write.c b/lib/full-write.c --- 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; }