One less call to fstatat() while building a file cache entry

Adds a realpathat2() which takes a pointer to a struct stat, and defines a
realpathat() which calls realpathat2() with a local variable of that type.

This structure will contain the result for the last call to fstatat(), so
there's no need to call it again outside realpathat() anymore.