diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/test/os-tests/tests/sockfs/rights.c | 10 |
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; |