From 8b15db6dcbc70dad56563c12d1f989a969f998d7 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 23 May 2020 10:03:44 +0900 Subject: [PATCH] Do not allow zero retries Retries actually means tries, e.g., if the user sets zero, s3fs will never try an operation at all. --- src/s3fs.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index a4cedd1..4b107b4 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -4562,7 +4562,12 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar return 0; } if(0 == STR2NCMP(arg, "retries=")){ - S3fsCurl::SetRetries(static_cast(cvt_strtoofft(strchr(arg, '=') + sizeof(char)))); + off_t retries = static_cast(cvt_strtoofft(strchr(arg, '=') + sizeof(char))); + if(retries == 0){ + S3FS_PRN_EXIT("retries must be greater than zero"); + return -1; + } + S3fsCurl::SetRetries(retries); return 0; } if(0 == STR2NCMP(arg, "use_cache=")){