diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 0ec8ffc..9289181 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -875,8 +875,9 @@ static int put_local_fd(const char* path, headers_t meta, int fd) { FGPRINT(" put_local_fd[path=%s][fd=%d]\n", path, fd); - if(fstat(fd, &st) == -1) + if(fstat(fd, &st) == -1){ YIKES(-errno); + } /* * Make decision to do multi upload (or not) based upon file size @@ -897,6 +898,13 @@ static int put_local_fd(const char* path, headers_t meta, int fd) { return -ENOTSUP; } + // seek to head of file. + if(0 != lseek(fd, 0, SEEK_SET)){ + SYSLOGERR("line %d: lseek: %d", __LINE__, -errno); + FGPRINT(" put_local_fd - lseek error(%d)\n", -errno); + return -errno; + } + if(st.st_size >= 20971520 && !nomultipart) { // 20MB // Additional time is needed for large files if(readwrite_timeout < 120)