Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/filemon Use O_CLOEXEC and save a syscall.
details: https://anonhg.NetBSD.org/src/rev/55b3ba7a3230
branches: trunk
changeset: 935849:55b3ba7a3230
user: sjg <sjg%NetBSD.org@localhost>
date: Fri Jul 10 15:53:30 2020 +0000
description:
Use O_CLOEXEC and save a syscall.
Reviewed by: riastradh
diffstat:
usr.bin/make/filemon/filemon_dev.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diffs (24 lines):
diff -r 9a33a48bdf55 -r 55b3ba7a3230 usr.bin/make/filemon/filemon_dev.c
--- a/usr.bin/make/filemon/filemon_dev.c Fri Jul 10 15:12:33 2020 +0000
+++ b/usr.bin/make/filemon/filemon_dev.c Fri Jul 10 15:53:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filemon_dev.c,v 1.2 2020/07/10 00:42:53 sjg Exp $ */
+/* $NetBSD: filemon_dev.c,v 1.3 2020/07/10 15:53:30 sjg Exp $ */
/*-
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -70,13 +70,12 @@
return NULL;
/* Try opening /dev/filemon, up to six times (cargo cult!). */
- for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR)) == -1; i++) {
+ for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) {
if (i == 5) {
error = errno;
goto fail0;
}
}
- (void)fcntl(F->fd, F_SETFD, FD_CLOEXEC);
/* Success! */
return F;
Home |
Main Index |
Thread Index |
Old Index