Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LeshengJin committed Jan 12, 2024
1 parent 95c0b69 commit d1337cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/support/pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class Pipe : public dmlc::Stream {
#ifdef _WIN32
auto fread = [&]() -> ssize_t {
DWORD nread;
if (!ReadFile(handle_, static_cast<TCHAR*>(ptr), size, &nread, nullptr)) return -1;
if (!ReadFile(handle_, static_cast<TCHAR*>(ptr), size, &nread, nullptr))
return static_cast<ssize_t>(-1);
return static_cast<ssize_t>(nread);
};
DWORD nread = static_cast<DWORD>(RetryCallOnEINTR(fread, GetLastErrorCode));
Expand All @@ -101,7 +102,8 @@ class Pipe : public dmlc::Stream {
#ifdef _WIN32
auto fwrite = [&]() -> ssize_t {
DWORD nwrite;
if (!WriteFile(handle_, static_cast<const TCHAR*>(ptr), size, &nwrite, nullptr)) return -1;
if (!WriteFile(handle_, static_cast<const TCHAR*>(ptr), size, &nwrite, nullptr))
return static_cast<ssize_t>(-1);
return static_cast<ssize_t>(nwrite);
};
DWORD nwrite = static_cast<DWORD>(RetryCallOnEINTR(fwrite, GetLastErrorCode));
Expand Down

0 comments on commit d1337cd

Please sign in to comment.