diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-11-15 04:24:42 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-11-15 04:24:42 -0500 |
commit | 312be3f9f5eab1643d7dcc7728c76d413d4f2640 (patch) | |
tree | 445eab9ef93914585b6625aa6ca93c24715771b7 /misc | |
parent | 82af0fa8de8201803ac670fa0de7d702ce9f0f18 (diff) | |
download | glibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.zip glibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.tar.gz glibc-312be3f9f5eab1643d7dcc7728c76d413d4f2640.tar.bz2 |
Clean up internal fopen uses
No need to ever not use c and e.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/getpass.c | 4 | ||||
-rw-r--r-- | misc/getttyent.c | 2 | ||||
-rw-r--r-- | misc/getusershell.c | 2 | ||||
-rw-r--r-- | misc/mntent_r.c | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/misc/getpass.c b/misc/getpass.c index 5290c3c..bdfa2c8 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 6d789c4..b1e6376 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 0e4f796..2e8d97e 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 0e9835c..3b5418a 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) |