From 523a4b53b34970014ee63087cd5bc04502920658 Mon Sep 17 00:00:00 2001 From: Bryan Ischo Date: Wed, 28 Sep 2011 00:22:11 -0700 Subject: Incorporated feedback from Shmuel Zeigerman sent in May 2009 that I never got around to incorporating into the source. --- GNUmakefile.mingw | 3 ++- src/s3.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/GNUmakefile.mingw b/GNUmakefile.mingw index 8925dd7..49d30b1 100644 --- a/GNUmakefile.mingw +++ b/GNUmakefile.mingw @@ -130,7 +130,8 @@ CFLAGS += -Wall -Werror -Wshadow -Wextra -Iinc \ -D__STRICT_ANSI__ \ -D_ISOC99_SOURCE \ -D_POSIX_C_SOURCE=200112L \ - -Dsleep=Sleep -DFOPEN_EXTRA_FLAGS=\"b\" \ + -Dsleep=Sleep -DSLEEP_UNITS_PER_SECOND=1000 \ + -DFOPEN_EXTRA_FLAGS=\"b\" \ -Iinc/mingw -include windows.h LDFLAGS = $(CURL_LIBS) $(LIBXML2_LIBS) diff --git a/src/s3.c b/src/s3.c index 6fd9f5f..0eda6de 100644 --- a/src/s3.c +++ b/src/s3.c @@ -46,6 +46,11 @@ #define FOPEN_EXTRA_FLAGS "" #endif +// Some Unix stuff (to work around Windows issues) +#ifndef SLEEP_UNITS_PER_SECOND +#define SLEEP_UNITS_PER_SECOND 1 +#endif + // Also needed for Windows, because somehow MinGW doesn't define this extern int putenv(char *); @@ -667,12 +672,11 @@ static int convert_simple_acl(char *aclXml, char *ownerId, return 1; } - static int should_retry() { if (retriesG--) { // Sleep before next retry; start out with a 1 second sleep - static int retrySleepInterval = 1; + static int retrySleepInterval = 1 * SLEEP_UNITS_PER_SECOND; sleep(retrySleepInterval); // Next sleep 1 second longer retrySleepInterval++; @@ -1220,7 +1224,6 @@ static void list_bucket(const char *bucketName, const char *prefix, if (statusG != S3StatusOK) { break; } - marker = data.nextMarker; } while (data.isTruncated && (!maxkeys || (data.keyCount < maxkeys))); if (statusG == S3StatusOK) { @@ -2663,6 +2666,7 @@ int main(int argc, char **argv) break; case 'r': { const char *v = optarg; + retriesG = 0; while (*v) { retriesG *= 10; retriesG += *v - '0'; -- cgit v1.2.1