From bf0a010cf705d21c75d2c6ba8de38cec038f9aa1 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Mon, 11 Jun 2001 13:58:02 +0000 Subject: Copy files until EOF, not the reported file size, to deal with bad sizes in the proc filesystem. --- libbb/copy_file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libbb/copy_file.c') diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 22684be74..24bdf9002 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c @@ -94,7 +94,7 @@ int copy_file(const char *source, const char *dest, int flags) umask(saved_umask); } - + /* Recursively copy files in SOURCE. */ if ((dp = opendir(source)) == NULL) { perror_msg("unable to open directory `%s'", source); @@ -116,7 +116,7 @@ int copy_file(const char *source, const char *dest, int flags) free(new_source); free(new_dest); } - + /* ??? What if an error occurs in readdir? */ if (closedir(dp) < 0) { @@ -173,7 +173,8 @@ int copy_file(const char *source, const char *dest, int flags) goto end; } - copy_file_chunk(sfp, dfp, source_stat.st_size); + if (copy_file_chunk(sfp, dfp, -1) < 0) + status = -1; if (fclose(dfp) < 0) { perror_msg("unable to close `%s'", dest); -- cgit v1.2.3-55-g6feb