summaryrefslogtreecommitdiffstats
path: root/lib/libutil/logwtmp.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-08-30 14:44:45 +0000
committerguenther <guenther@openbsd.org>2016-08-30 14:44:45 +0000
commit478ad52bba6ed7f0eb423b292954c9e49b312fd9 (patch)
tree0dc470f0e0857536301fc906251a8270c9fe1d7e /lib/libutil/logwtmp.c
parentAdd OPTION_ARG_TIME for parsing a (64 bit if needed) time_t (diff)
downloadwireguard-openbsd-478ad52bba6ed7f0eb423b292954c9e49b312fd9.tar.xz
wireguard-openbsd-478ad52bba6ed7f0eb423b292954c9e49b312fd9.zip
Use O_CLOEXEC when opening fds local to a function
ok jca@ krw@
Diffstat (limited to 'lib/libutil/logwtmp.c')
-rw-r--r--lib/libutil/logwtmp.c4
1 files changed, 2 insertions, 2 deletions
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));