Merge pull request #19 from s3fs-fuse/test_md5

Fixed a bug(googlecode issue 405), enable_content_md5 Input/output error
This commit is contained in:
Takeshi Nakatani 2014-03-04 01:24:23 +09:00
commit 39402696ce

View File

@ -3426,6 +3426,14 @@ unsigned char* md5hexsum(int fd, off_t start, ssize_t size)
ssize_t bytes;
unsigned char* result;
if(-1 == size){
struct stat st;
if(-1 == fstat(fd, &st)){
return NULL;
}
size = static_cast<ssize_t>(st.st_size);
}
// seek to top of file.
if(-1 == lseek(fd, start, SEEK_SET)){
return NULL;
@ -3457,7 +3465,6 @@ unsigned char* md5hexsum(int fd, off_t start, ssize_t size)
free(result);
return NULL;
}
return result;
}