diff --git a/lib/libc/gen/fmtmsg.c b/lib/libc/gen/fmtmsg.c index c6ecbd5f7653..d2c67a6cb014 100644 --- a/lib/libc/gen/fmtmsg.c +++ b/lib/libc/gen/fmtmsg.c @@ -83,7 +83,7 @@ def: if (output == NULL) return (MM_NOCON); if (*output != '\0') { - if ((fp = fopen("/dev/console", "a")) == NULL) { + if ((fp = fopen("/dev/console", "ae")) == NULL) { free(output); return (MM_NOCON); } diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index c321d122db12..f2f3777ab14e 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -654,7 +654,7 @@ cgetnext(char **bp, char **db_array) if (dbp == NULL) dbp = db_array; - if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) { + if (pfp == NULL && (pfp = fopen(*dbp, "re")) == NULL) { (void)cgetclose(); return (-1); } @@ -679,7 +679,7 @@ cgetnext(char **bp, char **db_array) (void)cgetclose(); return (0); } else if ((pfp = - fopen(*dbp, "r")) == NULL) { + fopen(*dbp, "re")) == NULL) { (void)cgetclose(); return (-1); } else diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 18f64a8fef75..f9480c3a22fc 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -810,7 +810,7 @@ files_setgrent(void *retval, void *mdata, va_list ap) if (st->fp != NULL) rewind(st->fp); else if (stayopen) - st->fp = fopen(_PATH_GROUP, "r"); + st->fp = fopen(_PATH_GROUP, "re"); break; case ENDGRENT: if (st->fp != NULL) { @@ -861,7 +861,7 @@ files_group(void *retval, void *mdata, va_list ap) if (*errnop != 0) return (NS_UNAVAIL); if (st->fp == NULL && - ((st->fp = fopen(_PATH_GROUP, "r")) == NULL)) { + ((st->fp = fopen(_PATH_GROUP, "re")) == NULL)) { *errnop = errno; return (NS_UNAVAIL); } @@ -1251,7 +1251,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap) if (st->fp != NULL) rewind(st->fp); else if (stayopen) - st->fp = fopen(_PATH_GROUP, "r"); + st->fp = fopen(_PATH_GROUP, "re"); set_setent(dtab, mdata); (void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, "setgrent", compatsrc, 0); @@ -1335,7 +1335,7 @@ compat_group(void *retval, void *mdata, va_list ap) if (*errnop != 0) return (NS_UNAVAIL); if (st->fp == NULL && - ((st->fp = fopen(_PATH_GROUP, "r")) == NULL)) { + ((st->fp = fopen(_PATH_GROUP, "re")) == NULL)) { *errnop = errno; rv = NS_UNAVAIL; goto fin; diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 51b3e3758b61..4c564613c2e7 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -173,7 +173,7 @@ setnetgrent(const char *group) if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && errno == ENOENT) || _yp_statp.st_size == 0) _use_only_yp = _netgr_yp_enabled = 1; - if ((netf = fopen(_PATH_NETGROUP,"r")) != NULL ||_use_only_yp){ + if ((netf = fopen(_PATH_NETGROUP,"re")) != NULL ||_use_only_yp){ /* * Icky: grab the first character of the netgroup file * and turn on NIS if it's a '+'. rewind the stream @@ -197,7 +197,7 @@ setnetgrent(const char *group) return; } #else - if ((netf = fopen(_PATH_NETGROUP, "r"))) { + if ((netf = fopen(_PATH_NETGROUP, "re"))) { #endif if (parse_netgrp(group)) endnetgrent(); diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index f2fc298a4fd5..b82c30abe366 100644 --- a/lib/libc/gen/getttyent.c +++ b/lib/libc/gen/getttyent.c @@ -211,7 +211,7 @@ setttyent(void) if (tf) { rewind(tf); return (1); - } else if ( (tf = fopen(_PATH_TTYS, "r")) ) + } else if ( (tf = fopen(_PATH_TTYS, "re")) ) return (1); return (0); } diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c index ce50069d258f..53536e136f82 100644 --- a/lib/libc/gen/getusershell.c +++ b/lib/libc/gen/getusershell.c @@ -115,7 +115,7 @@ _local_initshells(rv, cb_data, ap) sl_free(sl, 1); sl = sl_init(); - if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) + if ((fp = fopen(_PATH_SHELLS, "re")) == NULL) return NS_UNAVAIL; cp = line; diff --git a/lib/libc/gen/getutxent.c b/lib/libc/gen/getutxent.c index a2e938a988f5..20e8859f6cd7 100644 --- a/lib/libc/gen/getutxent.c +++ b/lib/libc/gen/getutxent.c @@ -71,7 +71,7 @@ setutxdb(int db, const char *file) if (uf != NULL) fclose(uf); - uf = fopen(file, "r"); + uf = fopen(file, "re"); if (uf == NULL) return (-1);