Skip to content

Commit

Permalink
Clear errno just in case.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b45ff66a66fba605e5a1b500a1ab66eb87140e19
  • Loading branch information
levlam committed Jan 30, 2018
1 parent d7ecc96 commit 6cf95c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tdutils/td/utils/port/Fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ auto skip_eintr(F &&f) {
decltype(f()) res;
static_assert(std::is_integral<decltype(res)>::value, "integral type expected");
do {
errno = 0; // just in case
res = f();
} while (res < 0 && errno == EINTR);
return res;
Expand All @@ -190,6 +191,7 @@ template <class F>
auto skip_eintr_cstr(F &&f) {
char *res;
do {
errno = 0; // just in case
res = f();
} while (res == nullptr && errno == EINTR);
return res;
Expand Down

0 comments on commit 6cf95c3

Please sign in to comment.