From 478ad52bba6ed7f0eb423b292954c9e49b312fd9 Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 30 Aug 2016 14:44:45 +0000 Subject: Use O_CLOEXEC when opening fds local to a function ok jca@ krw@ --- lib/libutil/logwtmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libutil/logwtmp.c') diff --git a/lib/libutil/logwtmp.c b/lib/libutil/logwtmp.c index 0f968c7679a..decde069377 100644 --- a/lib/libutil/logwtmp.c +++ b/lib/libutil/logwtmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logwtmp.c,v 1.9 2005/08/02 21:46:23 espie Exp $ */ +/* $OpenBSD: logwtmp.c,v 1.10 2016/08/30 14:44:45 guenther Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -46,7 +46,7 @@ logwtmp(const char *line, const char *name, const char *host) struct utmp ut; int fd; - if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) + if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND|O_CLOEXEC)) < 0) return; if (fstat(fd, &buf) == 0) { (void) strncpy(ut.ut_line, line, sizeof(ut.ut_line)); -- cgit v1.2.3-59-g8ed1b