Here is the updated patch implementing the dynamic allocation with
realpath(path, nullptr) and std::unique_ptr as suggested. It builds
cleanly and fixes the FTBFS.
--- a/httplib.h
+++ b/httplib.h
@@ -1035,5 +1035,9 @@
#else
- char buf[PATH_MAX];
- if (realpath(path, buf) == nullptr) { return false; }
- resolved = buf;
+ char* raw_resolved_path = realpath(path, nullptr);
+ if (raw_resolved_path == nullptr){ return false;}
+ std::unique_ptr<char, void(*)(void*)>safe_path(raw_resolved_path, std::free);
+ resolved = safe_path.get();
#endif