The Windows Universal C Runtime (ucrt) "_creat" function is no
longer POSIX compatible and requires Windows specific mode flags.
We got admin socket test failures after switching from msvcrt to
uscrt.
We'll address the issue with some platform checks.
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
::close(fd);
}
snprintf(fn, sizeof(fn)-1, "%s/done", base);
+ #ifdef _WIN32
+ ::creat(fn, _S_IREAD);
+ #else
::creat(fn, 0444);
+ #endif
}
}
}
ASSERT_FALSE(ok);
}
// file exists but does not allow connections (no process, wrong type...)
+ #ifdef _WIN32
+ int fd = ::creat(path.c_str(), _S_IREAD | _S_IWRITE);
+ #else
int fd = ::creat(path.c_str(), 0777);
+ #endif
ASSERT_TRUE(fd);
// On Windows, we won't be able to remove the file unless we close it
// first.
{
int fd = 0;
string message;
+ #ifdef _WIN32
+ int fd2 = ::creat(path.c_str(), _S_IREAD | _S_IWRITE);
+ #else
int fd2 = ::creat(path.c_str(), 0777);
+ #endif
ASSERT_TRUE(fd2);
// On Windows, we won't be able to remove the file unless we close it
// first.