return -EPERM on 403 (access forbidden) instead of -EIO

git-svn-id: http://s3fs.googlecode.com/svn/trunk@373 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
ben.lemasurier@gmail.com 2011-08-30 19:44:26 +00:00
parent ac54fad06e
commit 4ba385d1be
2 changed files with 8 additions and 8 deletions

View File

@ -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");

View File

@ -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><Name>" + bucket + "</Name>";
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