mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
fix infinite loop when errno is EINTR
This commit is contained in:
parent
f19cbbbd31
commit
fc19b58459
@ -3974,7 +3974,7 @@ GHC_INLINE bool copy_file(const path& from, const path& to, copy_options options
|
|||||||
}
|
}
|
||||||
ssize_t br, bw;
|
ssize_t br, bw;
|
||||||
while (true) {
|
while (true) {
|
||||||
do { br = ::read(in, buffer.data(), buffer.size()); } while(errno == EINTR);
|
do { br = ::read(in, buffer.data(), buffer.size()); } while(errno == EINTR && !br);
|
||||||
if(!br) {
|
if(!br) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5693,7 +5693,7 @@ public:
|
|||||||
, _entry(nullptr)
|
, _entry(nullptr)
|
||||||
{
|
{
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
do { _dir = ::opendir(path.native().c_str()); } while(errno == EINTR);
|
do { _dir = ::opendir(path.native().c_str()); } while(errno == EINTR && !_dir);
|
||||||
if (!_dir) {
|
if (!_dir) {
|
||||||
auto error = errno;
|
auto error = errno;
|
||||||
_base = filesystem::path();
|
_base = filesystem::path();
|
||||||
@ -5720,7 +5720,7 @@ public:
|
|||||||
do {
|
do {
|
||||||
skip = false;
|
skip = false;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
do { _entry = ::readdir(_dir); } while(errno == EINTR);
|
do { _entry = ::readdir(_dir); } while(errno == EINTR && !_entry);
|
||||||
if (_entry) {
|
if (_entry) {
|
||||||
_dir_entry._path = _base;
|
_dir_entry._path = _base;
|
||||||
_dir_entry._path.append_name(_entry->d_name);
|
_dir_entry._path.append_name(_entry->d_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user