mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
pass "e" to fopen() to set O_CLOEXEC
ok guenther
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: login_fbtab.c,v 1.21 2025/11/24 12:44:25 jca Exp $ */
|
||||
/* $OpenBSD: login_fbtab.c,v 1.22 2026/03/11 14:59:10 deraadt Exp $ */
|
||||
|
||||
/************************************************************************
|
||||
* Copyright 1995 by Wietse Venema. All rights reserved. Some individual
|
||||
@@ -87,7 +87,7 @@ login_fbtab(const char *tty, uid_t uid, gid_t gid)
|
||||
mode_t prot;
|
||||
ssize_t len;
|
||||
|
||||
if ((fp = fopen(_PATH_FBTAB, "r")) == NULL)
|
||||
if ((fp = fopen(_PATH_FBTAB, "re")) == NULL)
|
||||
return;
|
||||
|
||||
while ((len = getline(&buf, &bufsize, fp)) != -1) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: passwd.c,v 1.56 2019/06/28 13:32:43 deraadt Exp $ */
|
||||
/* $OpenBSD: passwd.c,v 1.57 2026/03/11 14:59:10 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994, 1995
|
||||
@@ -324,9 +324,9 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw)
|
||||
|
||||
if (!master)
|
||||
pw_error(NULL, 0, 1);
|
||||
if (!(from = fdopen(ffd, "r")))
|
||||
if (!(from = fdopen(ffd, "re")))
|
||||
pw_error(master, 1, 1);
|
||||
if (!(to = fdopen(tfd, "w")))
|
||||
if (!(to = fdopen(tfd, "we")))
|
||||
pw_error(pw_lck ? pw_lck : NULL, pw_lck ? 1 : 0, 1);
|
||||
|
||||
for (done = 0; fgets(buf, (int)sizeof(buf), from);) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pidfile.c,v 1.14 2019/06/28 14:20:40 schwarze Exp $ */
|
||||
/* $OpenBSD: pidfile.c,v 1.15 2026/03/11 14:59:10 deraadt Exp $ */
|
||||
/* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@@ -62,7 +62,7 @@ pidfile(const char *basename)
|
||||
if (asprintf(&pidfile_path, "%s%s.pid", _PATH_VARRUN, basename) == -1)
|
||||
return (-1);
|
||||
|
||||
if ((f = fopen(pidfile_path, "w")) == NULL) {
|
||||
if ((f = fopen(pidfile_path, "we")) == NULL) {
|
||||
save_errno = errno;
|
||||
free(pidfile_path);
|
||||
pidfile_path = NULL;
|
||||
|
||||
Reference in New Issue
Block a user