That's a rather large hammer to hit an annoying nail with, but I haven't got any better idea ^^.
That looks sound at first glance, but I'll take a closer look at it tomorrow

.
----
EDIT: Huh. I was wondering about the whole fd -> path mapping, turns out getting the path from a (dir) fd is a fun game...
Short of checking what /proc/self/fd/%d points to, nothing really comes to mind... Which is somewhat iffy, so, eh, building a cache from opendir looks like a solid approach

.