Sure. Here is a rundown of the implementation:
- Get the parent directory of supplied path
- If the parent directory is not writeable return false
-
stat
the parent directory, and if that fails, return false - Check if the parent is 'sticky' (
S_ISVTX
on Darwin) and if it exists. If so, and if the current user (getuid
) owns the file, return true. - Return true as the best guess after all of that