Verified Commit ccb3715a 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 9493f1d5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -438,6 +438,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__);