[WIP] Use bool as return type on functions that return a bool

This code is so convoluted that it's quite possible that `fname` may be null at this point. Even though the comment says it's null due to an `out-of-memory` error that may not be the error case. This logic can be removed once we refactor the whole function and can be sure about the errors that may happen.