From 232f655663b3c09b1a19c8aa303917b7f9860be7 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 14 Dec 2018 13:42:43 +0100 Subject: [PATCH] trust_anchor_backoff_time also when appdata dir is not writable --- src/context.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/context.c b/src/context.c index aaea6d59..d952d8d6 100644 --- a/src/context.c +++ b/src/context.c @@ -5349,6 +5349,8 @@ int _getdns_context_write_priv_file(getdns_context *context, (void) close(fd); context->can_write_appdata = PROP_UNABLE; + context->trust_anchors_backoff_expiry = + _getdns_get_now_ms() + context->trust_anchors_backoff_time; return 0; } @@ -5361,9 +5363,12 @@ int _getdns_context_can_write_appdata(getdns_context *context) if (context->can_write_appdata == PROP_ABLE) return 1; - else if (context->can_write_appdata == PROP_UNABLE) - return 0; - + else if (context->can_write_appdata == PROP_UNABLE) { + if (_getdns_ms_until_expiry( + context->trust_anchors_backoff_expiry) > 0) + return 0; + context->can_write_appdata = PROP_UNKNOWN; + } (void) snprintf( test_fn, sizeof(test_fn) , "write-test-%d.tmp", arc4random());