From 4ba385d1be8477382806eeb221b601e50b096b82 Mon Sep 17 00:00:00 2001 From: "ben.lemasurier@gmail.com" Date: Tue, 30 Aug 2011 19:44:26 +0000 Subject: [PATCH] return -EPERM on 403 (access forbidden) instead of -EIO git-svn-id: http://s3fs.googlecode.com/svn/trunk@373 df820570-a93a-0410-bd06-b72b767a4274 --- src/curl.cpp | 9 +++------ src/s3fs.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/curl.cpp b/src/curl.cpp index 54d37f3..eea464b 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -148,13 +148,10 @@ int my_curl_easy_perform(CURL* curl, BodyStruct* body, FILE* f) { case 403: if(debug) syslog(LOG_ERR, "HTTP response code 403 was returned"); - if(body) { - if(body->size && debug) { + if(body) + if(body->size && debug) syslog(LOG_ERR, "Body Text: %s", body->text); - } - } - if(debug) syslog(LOG_DEBUG, "Now returning EIO"); - return -EIO; + return -EPERM; case 404: if(debug) syslog(LOG_DEBUG, "HTTP response code 404 was returned"); diff --git a/src/s3fs.cpp b/src/s3fs.cpp index fcbc97c..896ef78 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -2728,8 +2728,9 @@ static int s3fs_readdir( cout << "readdir[path=" << path << "]" << endl; // get a list of all the objects - if((list_bucket(path, &head)) != 0) - return -EIO; + int result; + if((result = list_bucket(path, &head)) != 0) + return result; if(head == NULL) return 0; @@ -3555,6 +3556,7 @@ static void s3fs_check_service(void) { } // make sure the bucket exists and we have access to it + /* string match = "" + bucket + ""; if(strstr(body.text, match.c_str()) == NULL) { fprintf (stderr, "%s: bucket \"%s\" is not part of the service specified by the credentials\n", @@ -3562,6 +3564,7 @@ static void s3fs_check_service(void) { destroy_curl_handle(curl); exit(EXIT_FAILURE); } + */ // once we arrive here, that means that our preliminary connection // worked and the bucket matches the credentials provided