The job of this function is to retrieve the file's path and filename for anonymous fds (such as redirected unix outputs). It shouldn't access the underlying filesystem at all: that's obviously wrong, since it shouldn't depend on when it's called, nor if the file was deleted or not (it's not the purpose of this function to deal with that).
But why? What's wrong with accessing the file system?
If stdout is a symlink, how is that different from stdout being the target of the symlink? Why is returning the latter the wrong thing to do?
For example, in theory, the file could get removed after retrieving its path (via F_GETPATH) and a symlink placed in place of it, then readlink would access that symlink and dereference it… Whether the rest of the code deals with such race conditions is another point, but I don't see why this function should have to concern itself with it, or access the filesystem at all? It's like needless corner cases to worry about.
Why is this a meaningful race? If you assume that the filesystem can be modified, how can a program do *anything* meaningful with the output of GetFinalPathNameByHandle(), *ever*?