I am working on a LD_PRELOAD wrapper for some glbc API.
So it gets access to raw dirfd(file descriptors of a directory).
I need to read/get the full path associated with the "dirfd", but should not close or do anything else to the dirfd.
How do I do that?
But this states
This function consumes ownership of the specified file descriptor. The returned object will take responsibility for closing it when the object goes out of scope.
That means, as I understand it, that I can turn dirfd into maybe a "File" handle and use metadata or something to get at the path assocaited with the dirfd.
But when the file handle goes out of scope, the dirfd wikll get closed.
Is there another way of doing this without closing or doing anything else dirfd?