From 5aaab1715958fdbbc4aa31fe3c5f3e342f748ed0 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 4 Jun 2015 19:23:17 +0000 Subject: [PATCH] make sure to check for resolv.conf update the first time the resolver is used after pid has changed. ok deraadt@ --- lib/libc/asr/asr.c | 10 +++++++++- lib/libc/asr/asr_private.h | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index 1d3e084dd3c..f0aef3dfb1a 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.37 2015/05/29 08:49:37 eric Exp $ */ +/* $OpenBSD: asr.c,v 1.38 2015/06/04 19:23:17 eric Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot * @@ -412,12 +412,20 @@ asr_check_reload(struct asr *asr) #if ASR_OPT_RELOADCONF struct stat st; struct timespec ts; + pid_t pid; #endif if (asr->a_path == NULL) return; #if ASR_OPT_RELOADCONF + + pid = getpid(); + if (pid != asr->a_pid) { + asr->a_pid = pid; + asr->a_rtime = 0; + } + if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) return; diff --git a/lib/libc/asr/asr_private.h b/lib/libc/asr/asr_private.h index d8eb98ae80e..31c4f4d33d1 100644 --- a/lib/libc/asr/asr_private.h +++ b/lib/libc/asr/asr_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asr_private.h,v 1.29 2015/05/29 08:49:37 eric Exp $ */ +/* $OpenBSD: asr_private.h,v 1.30 2015/06/04 19:23:17 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -141,6 +141,7 @@ struct asr_ctx { struct asr { char *a_path; + pid_t a_pid; time_t a_mtime; time_t a_rtime; struct asr_ctx *a_ctx; -- 2.20.1