[Bug 262895] access(2) man page should mention softlinks
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 262895] access(2) man page should mention softlinks"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 May 2024 22:12:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262895 --- Comment #5 from Jamie Landeg-Jones <jamie@catflap.org> --- (In reply to Dag-Erling Smørgrav from comment #4) Hi. Thanks for the feedback. I could be wrong, but I'll explain my situation as far as I can remember: I wasn't trying to open the file - I wanted to check the existence of any entry with that name in a directory before renaming a file to said name. Rather than "do it and see", if an entry of the destination name already existed, I wanted the options presented to the user prior to the rename to be changed appropriately. I saw at the end of the manpage for access(2) : "access() remains useful for providing clues to users as to whether operations make sense for particular filesystem objects (e.g. 'delete' menu item only highlighted in a writable folder ... avoiding interpretation of the st_mode bits that the application might not understand -- e.g. in the case of AFS). It also allows a cheaper file existence test than stat(2)." Going by that, access seemed the best option for the job, but of course, it failed when I had a softlink in the directory that pointed to a non-existent file, causing an unfriendly error rather than the result I wanted. OK, hardly the end of the world, but I had expected a test for whether an entry exists within a directory to not fail in this case, hence why I suggested adding the bit about softlinks to that paragraph (Incidentally, I meant "lstat" not "stat" - I have already corrected it in the review) -- You are receiving this mail because: You are on the CC list for the bug.