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;
|
decltype(f()) res;
|
||||||
static_assert(std::is_integral<decltype(res)>::value, "integral type expected");
|
static_assert(std::is_integral<decltype(res)>::value, "integral type expected");
|
||||||
do {
|
do {
|
||||||
|
errno = 0; // just in case
|
||||||
res = f();
|
res = f();
|
||||||
} while (res < 0 && errno == EINTR);
|
} while (res < 0 && errno == EINTR);
|
||||||
return res;
|
return res;
|
||||||
@ -190,6 +191,7 @@ template <class F>
|
|||||||
auto skip_eintr_cstr(F &&f) {
|
auto skip_eintr_cstr(F &&f) {
|
||||||
char *res;
|
char *res;
|
||||||
do {
|
do {
|
||||||
|
errno = 0; // just in case
|
||||||
res = f();
|
res = f();
|
||||||
} while (res == nullptr && errno == EINTR);
|
} while (res == nullptr && errno == EINTR);
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user