diff --git a/src/curl.cpp b/src/curl.cpp index faf1358..c247bcf 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2595,7 +2595,7 @@ void S3fsCurl::insertV4Headers() break; } - if(0 == payload_hash.length()){ + if(b_infile != NULL && 0 == payload_hash.length()){ S3FS_PRN_ERR("Failed to make SHA256."); // TODO: propagate error } diff --git a/src/openssl_auth.cpp b/src/openssl_auth.cpp index 7d4a937..5402d58 100644 --- a/src/openssl_auth.cpp +++ b/src/openssl_auth.cpp @@ -321,9 +321,13 @@ unsigned char* s3fs_sha256_fd(int fd, off_t start, off_t size) off_t bytes; unsigned char* result; + if(-1 == fd){ + return NULL; + } if(-1 == size){ struct stat st; if(-1 == fstat(fd, &st)){ + S3FS_PRN_ERR("fstat error(%d)", errno); return NULL; } size = st.st_size;