mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-10 16:20:59 +00:00
Fixes a compile-time bug in 32bit systems and a memory leak in md5sum()
git-svn-id: http://s3fs.googlecode.com/svn/trunk@367 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
parent
7412edd904
commit
cf43a2a260
@ -622,7 +622,7 @@ static int put_headers(const char *path, headers_t meta) {
|
||||
|
||||
// files larger than 5GB must be modified via the multipart interface
|
||||
s3fs_getattr(path, &buf);
|
||||
if(buf.st_size >= 5368709120)
|
||||
if(buf.st_size >= FIVE_GB)
|
||||
return(put_multipart_headers(path, meta));
|
||||
|
||||
s3_realpath = get_realpath(path);
|
||||
@ -1496,7 +1496,7 @@ string md5sum(int fd) {
|
||||
char buf[512];
|
||||
char hexbuf[3];
|
||||
ssize_t bytes;
|
||||
char *md5 = (char *)malloc(2 * MD5_DIGEST_LENGTH + 1);
|
||||
char md5[2 * MD5_DIGEST_LENGTH + 1];
|
||||
unsigned char *result = (unsigned char *) malloc(MD5_DIGEST_LENGTH);
|
||||
|
||||
memset(buf, 0, 512);
|
||||
@ -1517,7 +1517,7 @@ string md5sum(int fd) {
|
||||
free(result);
|
||||
lseek(fd, 0, 0);
|
||||
|
||||
return md5;
|
||||
return string(md5);
|
||||
}
|
||||
|
||||
static int s3fs_getattr(const char *path, struct stat *stbuf) {
|
||||
@ -2430,7 +2430,7 @@ static int s3fs_rename(const char *from, const char *to) {
|
||||
// files larger than 5GB must be modified via the multipart interface
|
||||
if(S_ISDIR(buf.st_mode))
|
||||
result = rename_directory(from, to);
|
||||
else if(buf.st_size >= 5368709120)
|
||||
else if(buf.st_size >= FIVE_GB)
|
||||
result = rename_large_object(from, to);
|
||||
else
|
||||
result = rename_object(from, to);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#define MULTIPART_SIZE 10485760 // 10MB
|
||||
#define MAX_REQUESTS 100 // max number of concurrent HTTP requests
|
||||
#define MAX_COPY_SOURCE_SIZE 524288000 // 500MB
|
||||
#define FIVE_GB 5368709120LL
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
Loading…
Reference in New Issue
Block a user