Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Dec 2025 19:13:52 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ee5ad300a0df - stable/14 - closefrom_test: Fix the first test
Message-ID:  <69445270.336c4.2b528dcd@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=ee5ad300a0df2e7dceeeda9bff1504c70ad84c69

commit ee5ad300a0df2e7dceeeda9bff1504c70ad84c69
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-10-23 19:59:32 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-18 18:44:51 +0000

    closefrom_test: Fix the first test
    
    The first test is supposed to close the new fd, but was instead not
    closing anything.
    
    Reviewed by:    ngie, markj
    Fixes:          3cedbec3ee08 ("Integrate tools/regression/fifo into ...")
    Differential Revision:  https://reviews.freebsd.org/D52799
    (cherry picked from commit b307799b5141331effbb93d7f87dd00e9b991982)
---
 tests/sys/file/closefrom_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/sys/file/closefrom_test.c b/tests/sys/file/closefrom_test.c
index e30c5eb3d591..e4e4514f74d7 100644
--- a/tests/sys/file/closefrom_test.c
+++ b/tests/sys/file/closefrom_test.c
@@ -148,7 +148,7 @@ main(void)
 
 	/* We'd better start up with fd's 0, 1, and 2 open. */
 	start = devnull();
-	if (start == -1)
+	if (start < 3)
 		fail("open", "bad descriptor %d", start);
 	ok("open");
 
@@ -159,9 +159,9 @@ main(void)
 	ok("highest_fd");
 
 	/* Try to use closefrom() for just closing fd 3. */
-	closefrom(start + 1);
+	closefrom(start);
 	fd = highest_fd();
-	if (fd != start)
+	if (fd != start - 1)
 		fail("closefrom", "highest fd %d", fd);
 	ok("closefrom");
 
@@ -169,7 +169,7 @@ main(void)
 	for (i = 0; i < 16; i++)
 		(void)devnull();
 	fd = highest_fd();
-	if (fd != start + 16)
+	if (fd != start + 15)
 		fail("open 16", "highest fd %d", fd);
 	ok("open 16");
 


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69445270.336c4.2b528dcd>