79730410

Date: 2025-08-09 04:12:41
Score: 1.5
Natty:
Report link

You can’t get both in a single syscall, but on Linux you can avoid a second full path resolution by:

open() (or openat2() if you want to block symlinks) to get the file descriptor.

Use readlink("/proc/self/fd/") to retrieve the resolved path from the kernel.

This way you walk the path only once, and /proc/self/fd just returns the path the kernel already resolved.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Nattee Kotsomnuan