Verified Commit 9cc1d170 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

bugfix: segfault on removing non-existent directory

add checks for directory existance before to remove it
parent c1a443e4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -453,6 +453,10 @@ int adafs_opendir(const std::string& path) {

int adafs_rmdir(const std::string& path) {
    auto md = adafs_metadata(path);
    if (md == nullptr) {
        errno = ENOENT;
        return -1;
    }

    if (!S_ISDIR(md->mode())) {
        CTX->log()->debug("{}() path is not a directory", __func__);