Ignore EAGAIN in mkdir (happens in Android).

GitOrigin-RevId: 1d5ab4e698de8b74d61d06e84d4ac27d84020e91
This commit is contained in:
levlam 2018-10-22 18:08:51 +03:00
parent d992c895d0
commit ae585729aa

View File

@ -91,7 +91,14 @@ Status rmrf(CSlice path) {
#if TD_PORT_POSIX
Status mkdir(CSlice dir, int32 mode) {
int mkdir_res = detail::skip_eintr([&] { return ::mkdir(dir.c_str(), static_cast<mode_t>(mode)); });
int mkdir_res = [&] {
int res;
do {
errno = 0; // just in case
res = ::mkdir(dir.c_str(), static_cast<mode_t>(mode));
} while (res < 0 && (errno == EINTR || errno == EAGAIN));
return res;
}();
if (mkdir_res == 0) {
return Status::OK();
}