git: a8fea07c3053 - main - sendfile_test: fix copy-paste bug

From: Eric van Gyzen <vangyzen_at_FreeBSD.org>
Date: Thu, 24 Feb 2022 23:05:38 UTC
The branch main has been updated by vangyzen:

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

commit a8fea07c3053293f35e00b9073b33ff6f1d9a067
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2022-02-24 22:53:03 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-02-24 23:05:12 +0000

    sendfile_test: fix copy-paste bug
    
    Require the newly opened file descriptor to be good, instead of
    re-requiring the one that was required three lines earlier.
    Thankfully, opening /dev/null is really unlikely to fail.
    
    Reported by:    Coverity
    MFC after:      1 week
    Sponsored by:   Dell EMC Isilon
---
 lib/libc/tests/sys/sendfile_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c
index 1700691495c4..c8df110c2a96 100644
--- a/lib/libc/tests/sys/sendfile_test.c
+++ b/lib/libc/tests/sys/sendfile_test.c
@@ -1110,7 +1110,7 @@ ATF_TC_BODY(s_negative_not_socket_file_descriptor, tc)
 	ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno));
 
 	client_sock = open(_PATH_DEVNULL, O_WRONLY);
-	ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno));
+	ATF_REQUIRE_MSG(client_sock != -1, "open failed: %s", strerror(errno));
 
 	error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0));
 	ATF_REQUIRE_ERRNO(ENOTSOCK, error == -1);