diff options
author | tedu <> | 2005-12-22 06:52:11 +0000 |
---|---|---|
committer | tedu <> | 2005-12-22 06:52:11 +0000 |
commit | c0e4674989e5492be75d86e5226e184d39f5d5c3 (patch) | |
tree | 616d616100f271b1a47943d40e11dff1bf509706 | |
parent | f8452f05564b5820c3745b9348d85a2b3a745467 (diff) | |
download | openbsd-c0e4674989e5492be75d86e5226e184d39f5d5c3.tar.gz openbsd-c0e4674989e5492be75d86e5226e184d39f5d5c3.tar.bz2 openbsd-c0e4674989e5492be75d86e5226e184d39f5d5c3.zip |
handle chroot and res_init calls better. diagnosis assistance from otto.
ok deraadt otto.
-rw-r--r-- | src/lib/libc/net/res_init.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index 62ccb94630..43ee5ac6bb 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: res_init.c,v 1.33 2005/08/06 20:30:04 espie Exp $ */ | 1 | /* $OpenBSD: res_init.c,v 1.34 2005/12/22 06:52:11 tedu Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1985, 1989, 1993 | 4 | * ++Copyright++ 1985, 1989, 1993 |
@@ -178,27 +178,24 @@ _res_init(int usercall) | |||
178 | int dots; | 178 | int dots; |
179 | #endif | 179 | #endif |
180 | 180 | ||
181 | if (usercall == 0) { | 181 | if (!usercall && _resp->options & RES_INIT && |
182 | if (_resp->options & RES_INIT && | 182 | _resp->reschktime >= time(NULL)) |
183 | _resp->reschktime >= time(NULL)) | 183 | return (0); |
184 | _resp->reschktime = time(NULL) + __res_chktime; | ||
185 | if (stat(_PATH_RESCONF, &sb) != -1) { | ||
186 | if (!usercall && timespeccmp(&sb.st_mtimespec, | ||
187 | &_resp->restimespec, ==)) | ||
184 | return (0); | 188 | return (0); |
185 | _resp->reschktime = time(NULL) + __res_chktime; | 189 | else |
186 | if (stat(_PATH_RESCONF, &sb) != -1) { | 190 | _resp->restimespec = sb.st_mtimespec; |
187 | if (timespeccmp(&sb.st_mtimespec, | 191 | } else { |
188 | &_resp->restimespec, ==)) | 192 | /* |
189 | return (0); | 193 | * Lost the file, in chroot? |
190 | else | 194 | * Don't trash settings |
191 | _resp->restimespec = sb.st_mtimespec; | 195 | */ |
192 | } else { | 196 | if (!usercall && timespecisset(&_resp->restimespec)) |
193 | /* | 197 | return (0); |
194 | * Lost the file, in chroot? | 198 | } |
195 | * Don' trash settings | ||
196 | */ | ||
197 | if (timespecisset(&_resp->restimespec)) | ||
198 | return (0); | ||
199 | } | ||
200 | } else | ||
201 | _resp->reschktime = time(NULL) + __res_chktime; | ||
202 | 199 | ||
203 | 200 | ||
204 | /* | 201 | /* |