File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -778,7 +778,7 @@ int rem_file(const char* fileName)
778778
779779int copy_file (const char * in , const char * out )
780780{
781- byte buf [2500 ];
781+ byte buf [100 ];
782782 XFILE inFile = XBADFILE ;
783783 XFILE outFile = XBADFILE ;
784784 size_t sz ;
@@ -792,14 +792,10 @@ int copy_file(const char* in, const char* out)
792792 if (outFile == XBADFILE )
793793 goto cleanup ;
794794
795- sz = XFREAD (buf , 1 , sizeof (buf ), inFile );
796- /* 2500 bytes should be more than enough to read the entire files.
797- * Error out if we can't read the file all at once. */
798- if (sz == sizeof (buf ) || sz == 0 )
799- goto cleanup ;
800-
801- if (XFWRITE (buf , 1 , sz , outFile ) != sz )
802- goto cleanup ;
795+ while ((sz = XFREAD (buf , 1 , sizeof (buf ), inFile )) != 0 ) {
796+ if (XFWRITE (buf , 1 , sz , outFile ) != sz )
797+ goto cleanup ;
798+ }
803799
804800 ret = 0 ;
805801cleanup :
You can’t perform that action at this time.
0 commit comments