evilpie/filepath

Use fcntl F_GETPATH on MacOS

evilpie opened this issue · 0 comments

char pathbuf[PATH_MAX];
if (fcntl(fd, F_GETPATH, pathbuf) >= 0) {
    // pathbuf now contains *a* path to the open file descriptor
}

From https://stackoverflow.com/a/3444259

#define F_GETPATH 50 in https://github.com/st3fan/osx-10.9/blob/master/xnu-2422.1.72/bsd/sys/fcntl.h