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:
ben.lemasurier@gmail.com 2011-08-30 15:20:49 +00:00
parent 7412edd904
commit cf43a2a260
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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>