You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the open file is deleted after it is opened the file descriptor isn't associated with any path.
When the open file descriptor represents a hard-linked file multiple paths would correspond to this file descriptor and it doesn't make sense to ask for one path.
For the above reasons this function can't be implemented on FreeBSD, and on Linux it is essentially a hack and would fail when some of the above conditions would occur.
Remedy:
You should memorize the file path along with the FILE* pointer and use this path when needed instead.
The text was updated successfully, but these errors were encountered:
Hi @yurivict , it is possible the documentation would benefit from being more explicit than "if one can be obtained" to categorize the failure modes of the function. But if you look at how it is used in the one class that uses it, I believe we are essentially trying to verify the condition you propose using as an implementation, so that would not work. The limitations you mention (file deletion, at least) are precisely what we're trying to verify. Can it not be implemented on FreeBsd within the same operating parameters?
The limitations you mention (file deletion, at least) are precisely what we're trying to verify
File deletion can be easily tested with the stat call. But the possibility of hard-linking compromises such interface in general - it would have to return the list of paths instead of a single path. I don't think that in the scope of this project you need to run into such issue at all. IMO you should just use stat on the file path.
Description of Issue
The ArchGetFileName function suffers from these problems:
For the above reasons this function can't be implemented on FreeBSD, and on Linux it is essentially a hack and would fail when some of the above conditions would occur.
Remedy:
You should memorize the file path along with the
FILE*
pointer and use this path when needed instead.The text was updated successfully, but these errors were encountered: