diff --git a/src/filesys.cpp b/src/filesys.cpp index cf22af8e09..2d551d7a57 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -363,16 +363,15 @@ bool IsExecutable(const std::string &path) bool RecursiveDelete(const std::string &path) { - /* - Execute the 'rm' command directly, by fork() and execve() - */ + assert(IsPathAbsolute(path)); + if (!PathExists(path)) + return true; + + // Execute the 'rm' command directly, by fork() and execve() infostream << "Removing \"" << path << "\"" << std::endl; - assert(IsPathAbsolute(path)); - const pid_t child_pid = fork(); - if (child_pid == -1) { errorstream << "fork errno: " << errno << ": " << strerror(errno) << std::endl;