aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-05-22 22:09:51 +0300
committerEli Zaretskii2010-05-22 22:09:51 +0300
commit6e83d8007b844f1d0d68ad235015a154da8050c4 (patch)
tree594d2bbe15616629fbf0336a92df55d3ad4bcdd8 /src
parent9d5c6f0e5f80efa974c331c48304e353887c4632 (diff)
downloademacs-6e83d8007b844f1d0d68ad235015a154da8050c4.tar.gz
emacs-6e83d8007b844f1d0d68ad235015a154da8050c4.zip
Fix bug #6237.
w32.c (sys_write): Break writes into chunks smaller than 32MB.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/w32.c29
2 files changed, 33 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 489505f3cf3..540a85a6b1d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-05-22 Eli Zaretskii <eliz@gnu.org>
2
3 * w32.c (sys_write): Break writes into chunks smaller than 32MB.
4 (Bug#6237)
5
12010-05-22 Chong Yidong <cyd@stupidchicken.com> 62010-05-22 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * image.c (Fimage_flush): Rename from image-refresh. 8 * image.c (Fimage_flush): Rename from image-refresh.
diff --git a/src/w32.c b/src/w32.c
index 0f2d8b54e6b..0560ce4a6b8 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -5700,7 +5700,34 @@ sys_write (int fd, const void * buffer, unsigned int count)
5700 } 5700 }
5701 else 5701 else
5702#endif 5702#endif
5703 nchars = _write (fd, buffer, count); 5703 {
5704 /* Some networked filesystems don't like too large writes, so
5705 break them into smaller chunks. See the Comments section of
5706 the MSDN documentation of WriteFile for details behind the
5707 choice of the value of CHUNK below. See also the thread
5708 http://thread.gmane.org/gmane.comp.version-control.git/145294
5709 in the git mailing list. */
5710 const unsigned char *p = buffer;
5711 const unsigned chunk = 30 * 1024 * 1024;
5712
5713 nchars = 0;
5714 while (count > 0)
5715 {
5716 unsigned this_chunk = count < chunk ? count : chunk;
5717 int n = _write (fd, p, this_chunk);
5718
5719 nchars += n;
5720 if (n < 0)
5721 {
5722 nchars = n;
5723 break;
5724 }
5725 else if (n < this_chunk)
5726 break;
5727 count -= n;
5728 p += n;
5729 }
5730 }
5704 5731
5705 return nchars; 5732 return nchars;
5706} 5733}