Skip to content

Commit

Permalink
trust_anchor_backoff_time also when appdata dir is not writable
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop committed Dec 14, 2018
1 parent 9903723 commit 232f655
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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());

Expand Down

0 comments on commit 232f655

Please sign in to comment.