X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fcopy_file.c;h=c79fbeb14912fb8461ab0b1958896239c47846b1;hb=c126f8ffb6143f1455bea63dad21b2832ddb8b3c;hp=22684be74283c1bf0996637979a91c48ded60f9a;hpb=8a633268ef478a31bd649d582ce07e9c26a4a03a;p=oweals%2Fbusybox.git diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 22684be74..c79fbeb14 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "libbb.h" @@ -94,7 +95,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 +117,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 +174,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);