Prechádzať zdrojové kódy

Vlib: increase buffer to 4096 when copying files (sync to lib/gis/copy_dir.c)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72978 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 6 rokov pred
rodič
commit
e0a79948ba
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  1. 3 2
      lib/vector/Vlib/map.c

+ 3 - 2
lib/vector/Vlib/map.c

@@ -77,7 +77,7 @@ void Vect_destroy_map_struct(struct Map_info *p)
  */
  */
 static int copy_file(const char *src, const char *dst)
 static int copy_file(const char *src, const char *dst)
 {
 {
-    char buf[1024];
+    char buf[4096];
     int fd, fd2;
     int fd, fd2;
     FILE *f2;
     FILE *f2;
     int len, len2;
     int len, len2;
@@ -93,7 +93,8 @@ static int copy_file(const char *src, const char *dst)
 
 
     fd2 = fileno(f2);
     fd2 = fileno(f2);
 
 
-    while ((len = read(fd, buf, 1024)) > 0) {
+    len2 = 0;
+    while ((len = read(fd, buf, 4096)) > 0) {
         while (len && (len2 = write(fd2, buf, len)) >= 0)
         while (len && (len2 = write(fd2, buf, len)) >= 0)
             len -= len2;
             len -= len2;
     }
     }