Is it possible to open a symlink (won't follow) and read data from it?
I try to use open(2) system call, and I find one relevant flag: O_NOFOLLOW. But it will only return -1 rather than the symlink's file descriptor.
Can anyone give me some tips? Thanks! |
|
But how can I read data from symlink itself?
|
A symlink doesn't contain any data. It consists only of meta-data and is theoretically of size 0 bytes. Anything you need to know about the link can be gotten using 'lstat'.
|
I see. But lstat only provide me with its state data.
And how can I know which file it links to? I think I need to read its metadata, but which function can do this? |
Quote:
Quote:
|
All times are GMT -5. The time now is 05:26 AM. |