Clear errno just in case.
GitOrigin-RevId: b45ff66a66fba605e5a1b500a1ab66eb87140e19
This commit is contained in:
parent
d7ecc96113
commit
6cf95c36ad
@ -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;
|
||||
@ -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;
|
||||
|
Reference in New Issue
Block a user