summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJason King <jason.king@joyent.com>2020-07-07 14:00:27 -0500
committerJason King <jason.king@joyent.com>2020-07-08 17:13:41 -0500
commit480497bc2ff96b447dc09403a6c187a1593ac1ec (patch)
tree7d3f98498c99945ac532cbf72028f258c039e2c3 /usr/src
parentfdb2a7e9480266dfaa0b5aaa0e1237456552f332 (diff)
downloadillumos-joyent-480497bc2ff96b447dc09403a6c187a1593ac1ec.tar.gz
12934 sockfs rights test should close unneeded descriptors
Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/test/os-tests/tests/sockfs/rights.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/usr/src/test/os-tests/tests/sockfs/rights.c b/usr/src/test/os-tests/tests/sockfs/rights.c
index 97987d62c5..5e8382416f 100644
--- a/usr/src/test/os-tests/tests/sockfs/rights.c
+++ b/usr/src/test/os-tests/tests/sockfs/rights.c
@@ -11,6 +11,7 @@
/*
* Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -669,6 +670,15 @@ main(int argc, const char **argv)
sigset_t set;
int ret = 0;
+ /*
+ * The tests make assumptions about the number of open file descriptors
+ * present. In case we are invoked with more than just STDIN_FILENO,
+ * STDOUT_FILENO, and STDERR_FILENO open, close any other open
+ * descriptors that might exist. Otherwise their presence will violate
+ * the assumptions of the test and cause an erroneous failure.
+ */
+ closefrom(STDERR_FILENO + 1);
+
if (argc > 1 && strcmp(argv[1], "-d") == 0)
debug = _B_TRUE;