Verified Commit c9731c65 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Bugfix: links to pipe raise exception

In the kernel VFS some file descriptors under /proc/<PID>/fd/ could be
links to a pipe, this is a special case in which the `readlink` function
would not work. So when we detect this case we forward to kernel
parent 1cf0930a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -114,7 +114,8 @@ bool resolve_path (const std::string& path, std::string& resolved, bool resolve_
                char link_resolved[PATH_MAX_LEN];
                if (realpath(resolved.c_str(), link_resolved) == nullptr) {
                    CTX->log()->error("{}() Failed to get realpath for link '{}'. Error: {}", __func__, resolved, strerror(errno));
                    throw std::runtime_error("Failed to get realpath for link '" + resolved + "'. Error: " + strerror(errno));
                    resolved.append(path, end, std::string::npos);
                    return false;
                }
                // substituute resolved with new link path
                resolved = link_resolved;