Fix warnings.

This commit is contained in:
Victor Zverovich 2014-05-19 07:53:16 -07:00
parent 3c1bc74b04
commit 3159170383

View File

@ -121,7 +121,7 @@ int test::fclose(FILE *stream) {
int test::fileno(FILE *stream) { int test::fileno(FILE *stream) {
EMULATE_EINTR(fileno, -1); EMULATE_EINTR(fileno, -1);
return ::fileno(stream); return ::FMT_POSIX(fileno(stream));
} }
#ifndef _WIN32 #ifndef _WIN32
@ -204,7 +204,7 @@ TEST(FileTest, WriteRetry) {
} }
TEST(FileTest, DupNoRetry) { TEST(FileTest, DupNoRetry) {
int stdout_fd = fileno(stdout); int stdout_fd = FMT_POSIX(fileno(stdout));
dup_count = 1; dup_count = 1;
EXPECT_SYSTEM_ERROR(File::dup(stdout_fd), EINTR, EXPECT_SYSTEM_ERROR(File::dup(stdout_fd), EINTR,
str(fmt::Format("cannot duplicate file descriptor {}") << stdout_fd)); str(fmt::Format("cannot duplicate file descriptor {}") << stdout_fd));
@ -212,14 +212,16 @@ TEST(FileTest, DupNoRetry) {
} }
TEST(FileTest, Dup2Retry) { TEST(FileTest, Dup2Retry) {
File f1 = File::dup(fileno(stdout)), f2 = File::dup(fileno(stdout)); int stdout_fd = FMT_POSIX(fileno(stdout));
File f1 = File::dup(stdout_fd), f2 = File::dup(stdout_fd);
EXPECT_RETRY(f1.dup2(f2.descriptor()), dup2, EXPECT_RETRY(f1.dup2(f2.descriptor()), dup2,
str(fmt::Format("cannot duplicate file descriptor {} to {}") str(fmt::Format("cannot duplicate file descriptor {} to {}")
<< f1.descriptor() << f2.descriptor())); << f1.descriptor() << f2.descriptor()));
} }
TEST(FileTest, Dup2NoExceptRetry) { TEST(FileTest, Dup2NoExceptRetry) {
File f1 = File::dup(fileno(stdout)), f2 = File::dup(fileno(stdout)); int stdout_fd = FMT_POSIX(fileno(stdout));
File f1 = File::dup(stdout_fd), f2 = File::dup(stdout_fd);
ErrorCode ec; ErrorCode ec;
dup2_count = 1; dup2_count = 1;
f1.dup2(f2.descriptor(), ec); f1.dup2(f2.descriptor(), ec);