MCPcopy Create free account
hub / github.com/apache/arrow / FileIsClosed

Function FileIsClosed

cpp/src/arrow/testing/gtest_util.cc:599–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597#endif
598
599bool FileIsClosed(int fd) {
600#if defined(_WIN32)
601 // Disables default behavior on wrong params which causes the application to crash
602 // https://msdn.microsoft.com/en-us/library/ksazx244.aspx
603 _set_invalid_parameter_handler(InvalidParamHandler);
604
605 // Disables possible assertion alert box on invalid input arguments
606 _CrtSetReportMode(_CRT_ASSERT, 0);
607
608 int new_fd = _dup(fd);
609 if (new_fd == -1) {
610 return errno == EBADF;
611 }
612 _close(new_fd);
613 return false;
614#else
615 if (-1 != fcntl(fd, F_GETFD)) {
616 return false;
617 }
618 return errno == EBADF;
619#endif
620}
621
622#if !defined(_WIN32)
623void AssertChildExit(int child_pid, int expected_exit_status) {

Callers 4

TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls 1

_closeFunction · 0.85

Tested by

no test coverage detected