From 90c1dd8b74406566869f322b6acdb4e54699098a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 26 Jan 1994 18:20:04 +0000 Subject: [PATCH] . --- lib/Makefile.in | 8 ++++---- lib/full-write.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Makefile.in b/lib/Makefile.in index d80dee4f4..c9cc7968d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -33,18 +33,18 @@ libdir = $(exec_prefix)/lib 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 index 3fca56b0e..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,14 +41,17 @@ 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 -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 @@ safe_write (desc, ptr, len) #endif return written; } + total_written += written; ptr += written; len -= written; } - return 0; + return total_written; } -- 2.11.0