The UNTESTED #ifdef in freediskspace was never gated by any hints
file, so the unsigned-long-long path could only be enabled by a
stray manual #define -- in which case the return type is still
long and silently truncates. Remove the branches.
In fopenp the separator '/' write was unchecked: when the path
segment exactly filled the buffer to BUFSIZ-2 it would land at
buf[BUFSIZ-1] and the follow-on NUL would write past the end.
Guard the write.