From 312be3f9f5eab1643d7dcc7728c76d413d4f2640 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 15 Nov 2011 04:24:42 -0500 Subject: Clean up internal fopen uses No need to ever not use c and e. --- misc/getpass.c | 4 ++-- misc/getttyent.c | 2 +- misc/getusershell.c | 2 +- misc/mntent_r.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'misc') 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) -- cgit v1.2.3