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
This commit is contained in:
Eric van Gyzen 2022-02-24 16:53:03 -06:00
parent 062103fc93
commit a8fea07c30

View File

@ -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);