aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2016-06-01 14:03:28 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2016-06-01 14:03:28 -0700
commit8cdc4e5f8a2da70f35d4f640a2139d14bf34c3e7 (patch)
tree1db74bd69cf8046ad4fff035a3b9c4be39d6f14c
parent2ec184b3242dc725be2fce7e7afd633c7ba6271c (diff)
Fix format string crash bug
-rw-r--r--src/core/ext/resolver/dns/native/dns_resolver.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c
index d6e7c89ef8..eb6af26cfa 100644
--- a/src/core/ext/resolver/dns/native/dns_resolver.c
+++ b/src/core/ext/resolver/dns/native/dns_resolver.c
@@ -189,12 +189,17 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
gpr_timespec timeout = gpr_time_sub(next_try, now);
const char *msg = grpc_error_string(error);
- gpr_log(GPR_DEBUG, "dns resolution failed: retrying in %d.%09d seconds: %s",
- timeout.tv_sec, timeout.tv_nsec, msg);
+ gpr_log(GPR_DEBUG, "dns resolution failed: %s",msg);
grpc_error_free_string(msg);
GPR_ASSERT(!r->have_retry_timer);
r->have_retry_timer = true;
GRPC_RESOLVER_REF(&r->base, "retry-timer");
+ if (gpr_time_cmp(timeout, gpr_time_0(timeout.clock_type)) <= 0) {
+ gpr_log(GPR_DEBUG, "retrying in %d.%09d seconds",
+ timeout.tv_sec, timeout.tv_nsec);
+ } else {
+ gpr_log(GPR_DEBUG, "retrying immediately");
+ }
grpc_timer_init(exec_ctx, &r->retry_timer, next_try, dns_on_retry_timer, r,
now);
}