1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Author: Steffen Moeller <moeller@debian.org>
Description: int may not be enough (theoretically) for large files.
--- a/sched/file_upload_handler.cpp
+++ b/sched/file_upload_handler.cpp
@@ -137,13 +137,13 @@
bytes_left = nbytes - offset;
while (bytes_left > 0) {
- int n, m, to_write;
+ int m;
m = bytes_left<(double)BLOCK_SIZE ? (int)bytes_left : BLOCK_SIZE;
// try to get m bytes from socket (n>=0 is number actually returned)
//
- n = fread(buf, 1, m, in);
+ size_t n = fread(buf, 1, m, in);
// delay opening the file until we've done the first socket read
// to avoid filesystem lockups (WCG, possible paranoia)
@@ -209,7 +209,7 @@
// try to write n bytes to file
//
- to_write=n;
+ size_t to_write=n;
while (to_write > 0) {
ssize_t ret = write(fd, buf+n-to_write, to_write);
if (ret < 0) {
|