summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-11-15 04:24:42 -0500
committerUlrich Drepper <drepper@gmail.com>2011-11-15 04:24:42 -0500
commit312be3f9f5eab1643d7dcc7728c76d413d4f2640 (patch)
tree445eab9ef93914585b6625aa6ca93c24715771b7
parent82af0fa8de8201803ac670fa0de7d702ce9f0f18 (diff)
downloadglibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.tar.gz
glibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.tar.xz
glibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.zip
Clean up internal fopen uses
No need to ever not use c and e.
-rw-r--r--ChangeLog65
-rw-r--r--hesiod/hesiod.c4
-rw-r--r--iconv/gconv_conf.c2
-rw-r--r--inet/rcmd.c12
-rw-r--r--inet/ruserpass.c2
-rw-r--r--intl/localealias.c2
-rw-r--r--misc/getpass.c4
-rw-r--r--misc/getttyent.c2
-rw-r--r--misc/getusershell.c2
-rw-r--r--misc/mntent_r.c6
-rw-r--r--nis/nis_file.c6
-rw-r--r--nis/nss-default.c5
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/pthread_getattr_np.c6
-rw-r--r--nss/nss_files/files-XXX.c2
-rw-r--r--nss/nss_files/files-alias.c4
-rw-r--r--nss/nss_files/files-initgroups.c2
-rw-r--r--nss/nss_files/files-key.c2
-rw-r--r--nss/nss_files/files-netgrp.c4
-rw-r--r--nss/nsswitch.c2
-rw-r--r--resolv/gethnamaddr.c6
-rw-r--r--resolv/res_hconf.c2
-rw-r--r--resolv/res_query.c2
-rw-r--r--sysdeps/posix/getaddrinfo.c2
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c2
-rw-r--r--sysdeps/unix/sysv/linux/readonly-area.c4
-rw-r--r--time/getdate.c6
27 files changed, 117 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 054fbc2ac2..139ba57532 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,68 @@
+2011-11-15  Ulrich Drepper  <drepper@gmail.com>
+
+	* time/getdate.c (__getdate_r): Set FD_CLOEXEC for given file.
+
+	* sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area): Set
+	FD_CLOEXEC for /proc/self/maps.
+
+	* sysdeps/unix/sysv/linux/getsysstats.c (phys_pages_info): Set
+	FD_CLOEXEC for /proc/meminfo.
+
+	* sysdeps/posix/getaddrinfo.c (gaiconf_init): Set FD_CLOEXEC for
+	gai.conf.
+
+	* resolv/res_query.c (res_hostalias):  Don't allow cancellation and set
+	FD_CLOEXEC for given file.
+
+	* resolv/res_hconf.c (do_init): Set FD_CLOEXEC for host.conf.
+
+	* resolv/gethnamaddr.c (_sethtent): Don't allow cancellation and set
+	FD_CLOEXEC for /etc/hosts.
+	(_gethtent): Likewise.
+
+	* nss/nsswitch.c (nss_parse_file): Set FD_CLOEXEC.
+
+	* nss/nss_files/files-netgrp.c (_nss_files_setnetgrent): Don't allow
+	cancellation and set FD_CLOEXEC for /etc/netgroup.
+
+	* nss/nss_files/files-key.c (search): Don't allow cancellation when
+	reading /etc/publickey.
+
+	* nss/nss_files/files-initgroups.c (_nss_files_initgroups_dyn): Don't
+	allow cancellation when reading /etc/group.
+
+	* nss/nss_files/files-alias.c (internal_setent): Don't allow
+	cancellation.
+	(get_next_alias): Likewise for included file.  Also set FD_CLOEXEC.
+
+	* nss/nss_files/files-XXX.c (internal_setent): Don't allow cancellation
+	when using data file.
+
+	* nis/nss-default.c (init): Set FD_CLOEXEC for /etc/default/nss.
+
+	* nis/nis_file.c (read_nis_obj): Set FD_CLOEXEC.
+	(write_nis_obj): Use "c" and "e" in fopen.
+
+	* misc/mntent_r.c (__setmntent): Also append e to fopen format.
+
+	* misc/getusershell.c (initshells): Set FD_CLOEXEC for /etc/shells.
+
+	* misc/getttyent.c (setttyent): Set FD_CLOEXEC.
+
+	* misc/getpass.c (getpass): Set FD_CLOEXEC for /dev/tty.
+
+	* intl/localealias.c (read_alias_file): Set FD_CLOEXEC for
+	locale.alias.
+
+	* inet/ruserpass.c (ruserpass): Set FD_CLOEXEC for .netrc.
+
+	* inet/rcmd.c (iruserfopen): Set FD_CLOEXEC for hosts.equiv.
+
+	* iconv/gconv_conf.c (read_conf_file): Set FD_CLOEXEC for config file.
+
+	* hesiod/hesiod.c (parse_config_file): Prevent cancellation in config
+	file parsing and set FD_CLOEXEC.
+
 2011-11-14  Ulrich Drepper  <drepper@gmail.com>
 
 	* time/tzfile.c (__tzfile_read): Use "e" in fopen call.
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index b3706b506b..a3f22e5c88 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -278,7 +278,7 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
 	/*
 	 * Now open and parse the file...
 	 */
-	if (!(fp = fopen(filename, "r")))
+	if (!(fp = fopen(filename, "rce")))
 		return (-1);
 
 	while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -482,7 +482,7 @@ __hesiod_res_get(void *context) {
 
 void
 __hesiod_res_set(void *context, struct __res_state *res,
-	         void (*free_res)(void *)) {
+		 void (*free_res)(void *)) {
 	struct hesiod_p *ctx = context;
 
 	if (ctx->res && ctx->free_res) {
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index b28cb3c9ab..7b7c340e99 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -364,7 +364,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len,
 {
   /* Note the file is opened with cancellation in the I/O functions
      disabled.  */
-  FILE *fp = fopen (filename, "rc");
+  FILE *fp = fopen (filename, "rce");
   char *line = NULL;
   size_t line_len = 0;
   static int modcounter;
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 343e0954db..5e18b12691 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -149,7 +149,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
 			__fxprintf(NULL, "rcmd: getaddrinfo: %s\n",
 				   gai_strerror(error));
 
-                return -1;
+		return -1;
 	}
 
 	pfd[0].events = POLLIN;
@@ -488,7 +488,7 @@ iruserfopen (const char *file, uid_t okuser)
     cp = _("not regular file");
   else
     {
-      res = fopen (file, "rc");
+      res = fopen (file, "rce");
       if (!res)
 	cp = _("cannot open");
       else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
@@ -574,8 +574,8 @@ ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost)
 
        if (hostf != NULL)
 	 {
-           isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
-           fclose (hostf);
+	   isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
+	   fclose (hostf);
 	 }
 
        seteuid (uid);
@@ -618,7 +618,7 @@ iruserok_af (raddr, superuser, ruser, luser, af)
   case AF_INET6:
     ra.ss_family = AF_INET6;
     memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
-            sizeof(struct in6_addr));
+	    sizeof(struct in6_addr));
     ralen = sizeof(struct sockaddr_in6);
     break;
   default:
@@ -778,7 +778,7 @@ __validuser2_sa(hostf, ra, ralen, luser, ruser, rhost)
 
     while (__getline (&buf, &bufsize, hostf) > 0) {
 	buf[bufsize - 1] = '\0'; /* Make sure it's terminated.  */
-        p = buf;
+	p = buf;
 
 	/* Skip empty or comment lines */
 	if (__isempty (p)) {
diff --git a/inet/ruserpass.c b/inet/ruserpass.c
index e5b2caf4dc..df423ba6ee 100644
--- a/inet/ruserpass.c
+++ b/inet/ruserpass.c
@@ -114,7 +114,7 @@ ruserpass(host, aname, apass)
 	buf = alloca (strlen (hdir) + 8);
 
 	__stpcpy (__stpcpy (buf, hdir), "/.netrc");
-	cfile = fopen(buf, "rc");
+	cfile = fopen(buf, "rce");
 	if (cfile == NULL) {
 		if (errno != ENOENT)
 			warn("%s", buf);
diff --git a/intl/localealias.c b/intl/localealias.c
index 6f5fa12495..6cc69c84b5 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -221,7 +221,7 @@ read_alias_file (fname, fname_len)
 
   /* Note the file is opened with cancellation in the I/O functions
      disabled.  */
-  fp = fopen (full_fname, "rc");
+  fp = fopen (full_fname, "rce");
   freea (full_fname);
   if (fp == NULL)
     return 0;
diff --git a/misc/getpass.c b/misc/getpass.c
index 5290c3c7d3..bdfa2c807a 100644
--- a/misc/getpass.c
+++ b/misc/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1999,2001,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1999,2001,2003-2005,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@ getpass (prompt)
   /* Try to write to and read from the terminal if we can.
      If we can't open the terminal, use stderr and stdin.  */
 
-  in = fopen ("/dev/tty", "w+c");
+  in = fopen ("/dev/tty", "w+ce");
   if (in == NULL)
     {
       in = stdin;
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 6d789c4e2e..b1e6376fb6 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -190,7 +190,7 @@ setttyent()
 	if (tf) {
 		(void)rewind(tf);
 		return (1);
-	} else if ((tf = fopen(_PATH_TTYS, "rc"))) {
+	} else if ((tf = fopen(_PATH_TTYS, "rce"))) {
 		/* We do the locking ourselves.  */
 		__fsetlocking (tf, FSETLOCKING_BYCALLER);
 		return (1);
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 0e4f79619f..2e8d97e65c 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -104,7 +104,7 @@ initshells()
 	shells = NULL;
 	free(strings);
 	strings = NULL;
-	if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL)
+	if ((fp = fopen(_PATH_SHELLS, "rce")) == NULL)
 		goto init_okshells_noclose;
 	if (fstat64(fileno(fp), &statb) == -1) {
 	init_okshells:
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 0e9835c61e..3b5418a193 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -38,10 +38,10 @@ FILE *
 __setmntent (const char *file, const char *mode)
 {
   /* Extend the mode parameter with "c" to disable cancellation in the
-     I/O functions.  */
+     I/O functions and "e" to set FD_CLOEXEC.  */
   size_t modelen = strlen (mode);
-  char newmode[modelen + 2];
-  memcpy (mempcpy (newmode, mode, modelen), "c", 2);
+  char newmode[modelen + 3];
+  memcpy (mempcpy (newmode, mode, modelen), "ce", 3);
   FILE *result = fopen (file, newmode);
 
   if (result != NULL)
diff --git a/nis/nis_file.c b/nis/nis_file.c
index 566f30c48c..dc382424be 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999, 2004, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -31,7 +31,7 @@ static void *
 read_nis_obj (const char *name, iofct_t readfct, freefct_t freefct,
 	      size_t objsize)
 {
-  FILE *in = fopen (name, "rc");
+  FILE *in = fopen (name, "rce");
   if (in == NULL)
     return NULL;
 
@@ -59,7 +59,7 @@ read_nis_obj (const char *name, iofct_t readfct, freefct_t freefct,
 static bool_t
 write_nis_obj (const char *name, const void *obj, iofct_t writefct)
 {
-  FILE *out = fopen (name, "w");
+  FILE *out = fopen (name, "wce");
   if (out == NULL)
     return FALSE;
 
diff --git a/nis/nss-default.c b/nis/nss-default.c
index d7a3293a49..e4dc3d6af1 100644
--- a/nis/nss-default.c
+++ b/nis/nss-default.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996,2001,2004,2006,2007,2010 Free Software Foundation, Inc.
+/* Copyright (C) 1996,2001,2004,2006,2007,2010,2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +58,7 @@ static void
 init (void)
 {
   int saved_errno = errno;
-  FILE *fp = fopen (default_nss, "rc");
+  FILE *fp = fopen (default_nss, "rce");
   if (fp != NULL)
     {
       char *line = NULL;
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 1c084f7e3c..9abaa26ba9 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-15  Ulrich Drepper  <drepper@gmail.com>
+
+	* pthread_getattr_np.c (pthread_getattr_np): Set FD_CLOEXEC for
+	/proc/self/maps.
+
 2011-10-29  Ulrich Drepper  <drepper@gmail.com>
 
 	[BZ #13358]
diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
index 9c25caff89..f03c97899c 100644
--- a/nptl/pthread_getattr_np.c
+++ b/nptl/pthread_getattr_np.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004, 2006, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -75,7 +75,7 @@ pthread_getattr_np (thread_id, attr)
       /* The safest way to get the top of the stack is to read
 	 /proc/self/maps and locate the line into which
 	 __libc_stack_end falls.  */
-      FILE *fp = fopen ("/proc/self/maps", "rc");
+      FILE *fp = fopen ("/proc/self/maps", "rce");
       if (fp == NULL)
 	ret = errno;
       /* We need the limit of the stack in any case.  */
@@ -164,7 +164,7 @@ pthread_getattr_np (thread_id, attr)
 	{
 	  free (cpuset);
 	  if (ret == ENOSYS)
-	    {	  
+	    {
 	      /* There is no such functionality.  */
 	      ret = 0;
 	      iattr->cpuset = NULL;
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 1a6fa0ddd5..8db052903f 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -77,7 +77,7 @@ internal_setent (int stayopen)
 
   if (stream == NULL)
     {
-      stream = fopen (DATAFILE, "re");
+      stream = fopen (DATAFILE, "rce");
 
       if (stream == NULL)
 	status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 714299aadf..023021e6ce 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -48,7 +48,7 @@ internal_setent (void)
 
   if (stream == NULL)
     {
-      stream = fopen ("/etc/aliases", "re");
+      stream = fopen ("/etc/aliases", "rce");
 
       if (stream == NULL)
 	status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
@@ -258,7 +258,7 @@ get_next_alias (const char *match, struct aliasent *result,
 
 		      first_unused = cp;
 
-		      listfile = fopen (&cp[9], "r");
+		      listfile = fopen (&cp[9], "rce");
 		      /* If the file does not exist we simply ignore
 			 the statement.  */
 		      if (listfile != NULL
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
index 2f88f602e7..3a3b5c1e38 100644
--- a/nss/nss_files/files-initgroups.c
+++ b/nss/nss_files/files-initgroups.c
@@ -30,7 +30,7 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
 			   long int *size, gid_t **groupsp, long int limit,
 			   int *errnop)
 {
-  FILE *stream = fopen ("/etc/group", "re");
+  FILE *stream = fopen ("/etc/group", "rce");
   if (stream == NULL)
     {
       *errnop = errno;
diff --git a/nss/nss_files/files-key.c b/nss/nss_files/files-key.c
index fb108c8092..cb39204825 100644
--- a/nss/nss_files/files-key.c
+++ b/nss/nss_files/files-key.c
@@ -33,7 +33,7 @@ extern int xdecrypt (char *, char *);
 static enum nss_status
 search (const char *netname, char *result, int *errnop, int secret)
 {
-  FILE *stream = fopen (DATAFILE, "re");
+  FILE *stream = fopen (DATAFILE, "rce");
   if (stream == NULL)
     return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
 
diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
index 4b5d774fdd..f70196bc7e 100644
--- a/nss/nss_files/files-netgrp.c
+++ b/nss/nss_files/files-netgrp.c
@@ -1,5 +1,5 @@
 /* Netgroup file parser in nss_files modules.
-   Copyright (C) 1996, 1997, 2000, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2004, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -63,7 +63,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result)
     return NSS_STATUS_UNAVAIL;
 
   /* Find the netgroups file and open it.  */
-  fp = fopen (DATAFILE, "r");
+  fp = fopen (DATAFILE, "rce");
   if (fp == NULL)
     status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
   else
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 09fa0a6694..6ac1458a62 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -503,7 +503,7 @@ nss_parse_file (const char *fname)
   size_t len;
 
   /* Open the configuration file.  */
-  fp = fopen (fname, "rc");
+  fp = fopen (fname, "rce");
   if (fp == NULL)
     return NULL;
 
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 5cf660a8d4..a8ccf1fd3a 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -585,7 +585,7 @@ gethostbyname2(name, af)
 			}
 			if (!isdigit(*cp) && *cp != '.')
 				break;
-               }
+	       }
 	if ((isxdigit(name[0]) && strchr(name, ':') != NULL) ||
 	    name[0] == ':')
 		for (cp = name;; ++cp) {
@@ -787,7 +787,7 @@ _sethtent(f)
 	int f;
 {
 	if (!hostf)
-		hostf = fopen(_PATH_HOSTS, "r" );
+		hostf = fopen(_PATH_HOSTS, "rce" );
 	else
 		rewind(hostf);
 	stayopen = f;
@@ -810,7 +810,7 @@ _gethtent()
 	register char *cp, **q;
 	int af, len;
 
-	if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" ))) {
+	if (!hostf && !(hostf = fopen(_PATH_HOSTS, "rce" ))) {
 		__set_h_errno (NETDB_INTERNAL);
 		return (NULL);
 	}
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index 7b167bb3bf..6f831ec6b8 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -307,7 +307,7 @@ do_init (void)
   if (hconf_name == NULL)
     hconf_name = _PATH_HOSTCONF;
 
-  fp = fopen (hconf_name, "rc");
+  fp = fopen (hconf_name, "rce");
   if (fp)
     {
       /* No threads using this stream.  */
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 2f7cfaa4b7..947c6513a2 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -602,7 +602,7 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
 	if (statp->options & RES_NOALIASES)
 		return (NULL);
 	file = getenv("HOSTALIASES");
-	if (file == NULL || (fp = fopen(file, "r")) == NULL)
+	if (file == NULL || (fp = fopen(file, "rce")) == NULL)
 		return (NULL);
 	setbuf(fp, NULL);
 	buf[sizeof(buf) - 1] = '\0';
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 216c9cce5f..1a023f91f5 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1958,7 +1958,7 @@ gaiconf_init (void)
   size_t nscopelist = 0;
   bool scopelist_nullbits = false;
 
-  FILE *fp = fopen (GAICONF_FNAME, "rc");
+  FILE *fp = fopen (GAICONF_FNAME, "rce");
   if (fp != NULL)
     {
       struct stat64 st;
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 7feb7a1802..bde3fa8999 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -296,7 +296,7 @@ phys_pages_info (const char *format)
   long int result = -1;
 
   /* If we haven't found an appropriate entry return 1.  */
-  FILE *fp = fopen ("/proc/meminfo", "rc");
+  FILE *fp = fopen ("/proc/meminfo", "rce");
   if (fp != NULL)
     {
       /* No threads use this stream.  */
diff --git a/sysdeps/unix/sysv/linux/readonly-area.c b/sysdeps/unix/sysv/linux/readonly-area.c
index 69e926a7a1..ce8ac94c4c 100644
--- a/sysdeps/unix/sysv/linux/readonly-area.c
+++ b/sysdeps/unix/sysv/linux/readonly-area.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@ __readonly_area (const char *ptr, size_t size)
 {
   const void *ptr_end = ptr + size;
 
-  FILE *fp = fopen ("/proc/self/maps", "rc");
+  FILE *fp = fopen ("/proc/self/maps", "rce");
   if (fp == NULL)
     {
       /* It is the system administrator's choice to not have /proc
diff --git a/time/getdate.c b/time/getdate.c
index cbaa41dfd2..a95bad4c4e 100644
--- a/time/getdate.c
+++ b/time/getdate.c
@@ -1,5 +1,5 @@
 /* Convert a string representation of time to a time value.
-   Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2001,2003,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
 
@@ -44,7 +44,7 @@ static int check_mday (int year, int mon, int mday);
      6  memory allication failed (not enough memory available),
      7  there is no line in the template that matches the input,
      8  invalid input specification Example: February 31 or a time is
-        specified that can not be represented in a time_t (representing
+	specified that can not be represented in a time_t (representing
 	the time in seconds since 00:00:00 UTC, January 1, 1970) */
 int getdate_err;
 
@@ -129,7 +129,7 @@ __getdate_r (const char *string, struct tm *tp)
     return 2;
 
   /* Open the template file.  */
-  fp = fopen (datemsk, "rc");
+  fp = fopen (datemsk, "rce");
   if (fp == NULL)
     return 2;