This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Open /etc/resolv.conf with FD_CLOEXEC
- From: Ross Lagerwall <rosslagerwall at gmail dot com>
- To: libc-alpha at sourceware dot org, rosslagerwall at gmail dot com
- Date: Mon, 21 Nov 2011 18:47:20 +0200
- Subject: [PATCH] Open /etc/resolv.conf with FD_CLOEXEC
Hello,
As per the comment for 312be3f9f, "c" and "e" should always be used for
internal fopen usage. This patch adds "e" for /etc/resolv.conf.
Ross
2011-11-21 Ross Lagerwall <rosslagerwall@gmail.com>
* resolv/res_init.c (__res_vinit): Open /etc/resolv.conf with
FD_CLOEXEC.
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 73caaa4..c58c763 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -233,7 +233,7 @@ __res_vinit(res_state statp, int preinit) {
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
- if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
+ if ((fp = fopen(_PATH_RESCONF, "rce")) != NULL) {
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
/* read the config file */