~ubuntu-branches/ubuntu/trusty/cctools/trusty-proposed

« back to all changes in this revision

Viewing changes to parrot/src/pfs_service_s3.cc

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2012-03-30 12:40:01 UTC
  • mfrom: (9.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120330124001-ze0lhxm5uwq2e3mo
Tags: 3.4.2-2
Added patch to handle a missing CFLAGS variable in Python's sysconfig
report (Closes: #661658).

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
public:
141
141
 
142
142
        pfs_service_s3() {
 
143
                char *endpoint;
143
144
                s3_file_cache = hash_table_create(0,NULL);
 
145
                if((endpoint = getenv("PARROT_S3_ENDPOINT"))) {
 
146
                        s3_set_endpoint(endpoint);
 
147
                }
144
148
        }
145
149
        ~pfs_service_s3() {
146
150
                //Delete file_cache;
159
163
                FILE *local_file = NULL;
160
164
 
161
165
                char *username, *password;
 
166
                if(!pfs_password_cache) {
 
167
                        errno = EACCES;
 
168
                        return NULL;
 
169
                }
162
170
                username = pfs_password_cache->username;
163
171
                password = pfs_password_cache->password;
164
172
 
214
222
                struct list *dirents;
215
223
                struct s3_dirent_object *d;
216
224
                char bucket[PFS_PATH_MAX];
 
225
                
 
226
                if(!pfs_password_cache) {
 
227
                        errno = EACCES;
 
228
                        return NULL;
 
229
                }
217
230
 
218
231
                sscanf(name->hostport, "%[^:]:", bucket);
219
232
 
240
253
                struct s3_dirent_object d;
241
254
                char bucket[PFS_PATH_MAX];
242
255
 
 
256
                if(!pfs_password_cache) {
 
257
                        errno = EACCES;
 
258
                        return -1;
 
259
                }
 
260
 
243
261
                sscanf(name->hostport, "%[^:]:", bucket);
244
262
 
245
263
                if( s3_stat_file(name->rest, bucket, &d, pfs_password_cache->username, pfs_password_cache->password) < 0 ) {
257
275
                struct s3_dirent_object d;
258
276
                char bucket[PFS_PATH_MAX];
259
277
 
 
278
                if(!pfs_password_cache) {
 
279
                        errno = EACCES;
 
280
                        return -1;
 
281
                }
 
282
 
260
283
                sscanf(name->hostport, "%[^:]:", bucket);
261
284
 
262
285
                if( s3_stat_file(name->rest, bucket, &d, pfs_password_cache->username, pfs_password_cache->password) < 0 ) {
276
299
                int result;
277
300
                char bucket[PFS_PATH_MAX];
278
301
 
 
302
                if(!pfs_password_cache) {
 
303
                        errno = EACCES;
 
304
                        return -1;
 
305
                }
 
306
 
279
307
                sscanf(name->hostport, "%[^:]:", bucket);
280
308
 
281
309
                sprintf(path, "%s:%s", bucket, name->rest);