diff options
author | skrivohatskiy <[email protected]> | 2024-05-19 17:07:17 +0300 |
---|---|---|
committer | skrivohatskiy <[email protected]> | 2024-05-19 17:19:48 +0300 |
commit | 0676c30682b50f90ece39fbfa92b94ebc569606a (patch) | |
tree | 3f9cca294e86cdc9c7cc0071c35f527d8be3d449 /util | |
parent | f6151f80bbf2e0ed9c2674ff584e6c7a53e7548e (diff) |
minor fix in util path
Мелкий фикс неверных исключений. Как будто у меня локально повторялось как минидамп на колонке (не отловленное исключение)
Зависит от реализации libc. Но кажется что исходный вариант все же не верный:
[ The value in errno is significant only when the return value of
the call indicated an error (i.e., -1 from most system calls; -1
or NULL from most library functions); a function that succeeds is
allowed to change errno. The value of errno is never set to zero
by any system call or library function.](https://man7.org/linux/man-pages/man3/errno.3.html)
1d2088da57c98f9d9abfd6da865219fcf74db212
Diffstat (limited to 'util')
-rw-r--r-- | util/folder/path.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp index 29a1689870b..940f6dffe0d 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -455,19 +455,19 @@ void TFsPath::ForceDelete() const { } } - ClearLastSystemError(); + bool succ; if (stat.IsDir()) { TVector<TFsPath> children; List(children); for (auto& i : children) { i.ForceDelete(); } - ::rmdir(this->c_str()); + succ = ::rmdir(this->c_str()) == 0; } else { - ::unlink(this->c_str()); + succ = ::unlink(this->c_str()) == 0; } - if (LastSystemError()) { + if (!succ && LastSystemError()) { ythrow TIoException() << "failed to delete " << Path_; } } |