[sampling_test] print errno when mkstemp fails

I see rare occasional failures there, which look very odd. Typically
both sampling and sampling_debug tests fail at about the same time. So
hopefully we can diagnose them sometime.
This commit is contained in:
Aliaksei Kandratsenka 2024-09-30 12:23:52 -04:00
parent 9d58d03fa4
commit 0f8cb8416e
1 changed files with 3 additions and 0 deletions

View File

@ -163,6 +163,9 @@ struct TempFile {
CHECK_EQ(it, path_template.get() + len); CHECK_EQ(it, path_template.get() + len);
int fd = mkstemp(path_template.get()); int fd = mkstemp(path_template.get());
if (fd < 0) {
perror("mkstemp");
}
CHECK_GE(fd, 0); CHECK_GE(fd, 0);
return TempFile{fdopen(fd, "r+"), std::string(path_template.get(), len-1)}; return TempFile{fdopen(fd, "r+"), std::string(path_template.get(), len-1)};