aboutsummaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-06-11 13:58:02 +0000
committerMatt Kraai <kraai@debian.org>2001-06-11 13:58:02 +0000
commitbf0a010cf705d21c75d2c6ba8de38cec038f9aa1 (patch)
tree5a059e12e61728a72d4ec58166ec63794d944ed3 /libbb/copy_file.c
parent5246225596a45de63a994abbef92b7d23180681c (diff)
downloadbusybox-w32-bf0a010cf705d21c75d2c6ba8de38cec038f9aa1.tar.gz
busybox-w32-bf0a010cf705d21c75d2c6ba8de38cec038f9aa1.tar.bz2
busybox-w32-bf0a010cf705d21c75d2c6ba8de38cec038f9aa1.zip
Copy files until EOF, not the reported file size, to deal with bad sizes in
the proc filesystem.
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r--libbb/copy_file.c7
1 files changed, 4 insertions, 3 deletions
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)
94 94
95 umask(saved_umask); 95 umask(saved_umask);
96 } 96 }
97 97
98 /* Recursively copy files in SOURCE. */ 98 /* Recursively copy files in SOURCE. */
99 if ((dp = opendir(source)) == NULL) { 99 if ((dp = opendir(source)) == NULL) {
100 perror_msg("unable to open directory `%s'", source); 100 perror_msg("unable to open directory `%s'", source);
@@ -116,7 +116,7 @@ int copy_file(const char *source, const char *dest, int flags)
116 free(new_source); 116 free(new_source);
117 free(new_dest); 117 free(new_dest);
118 } 118 }
119 119
120 /* ??? What if an error occurs in readdir? */ 120 /* ??? What if an error occurs in readdir? */
121 121
122 if (closedir(dp) < 0) { 122 if (closedir(dp) < 0) {
@@ -173,7 +173,8 @@ int copy_file(const char *source, const char *dest, int flags)
173 goto end; 173 goto end;
174 } 174 }
175 175
176 copy_file_chunk(sfp, dfp, source_stat.st_size); 176 if (copy_file_chunk(sfp, dfp, -1) < 0)
177 status = -1;
177 178
178 if (fclose(dfp) < 0) { 179 if (fclose(dfp) < 0) {
179 perror_msg("unable to close `%s'", dest); 180 perror_msg("unable to close `%s'", dest);