diff options
author | 2014-09-15 06:15:48 +0000 | |
---|---|---|
committer | 2014-09-15 06:15:48 +0000 | |
commit | 241db05998f1091df691c528a16b6ca3ab8719d3 (patch) | |
tree | 3f038d1b6f858c1d54403aea4e05196b78947f43 /lib/libc/asr/asr.c | |
parent | Pass O_CLOEXEC to open() or mkostemp() instead of setting FD_CLOEXEC afterwards (diff) | |
download | wireguard-openbsd-241db05998f1091df691c528a16b6ca3ab8719d3.tar.xz wireguard-openbsd-241db05998f1091df691c528a16b6ca3ab8719d3.zip |
When fopen()ing internal to libc (the API doesn't support the use
of the resulting FILE *), then pass fopen() the 'e' mode letter to
mark it close-on-exec.
ok miod@
Diffstat (limited to 'lib/libc/asr/asr.c')
-rw-r--r-- | lib/libc/asr/asr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index eceec10804f..0498d26d3a4 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.33 2014/03/26 18:13:15 eric Exp $ */ +/* $OpenBSD: asr.c,v 1.34 2014/09/15 06:15:48 guenther Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org> * @@ -695,7 +695,7 @@ asr_ctx_from_file(struct asr_ctx *ac, const char *path) char buf[4096]; ssize_t r; - cf = fopen(path, "r"); + cf = fopen(path, "re"); if (cf == NULL) return (-1); @@ -920,7 +920,7 @@ asr_hostalias(struct asr_ctx *ac, const char *name, char *abuf, size_t abufsz) asr_ndots(name) != 0 || issetugid() || (file = getenv("HOSTALIASES")) == NULL || - (fp = fopen(file, "r")) == NULL) + (fp = fopen(file, "re")) == NULL) return (NULL); DPRINT("asr: looking up aliases in \"%s\"\n", file); |