Permission to create a file/folder

Hello, what is the failsafe way to determine if my running app has the permission to create a r/w file or a folder without actually creating them? It's on POSIX if the platform matters.

Probably access, but beware of TOCTOU.

1 Like

Standard library has only very very basic support for permissions, so to use something more advanced you'd have to make system calls (i.e. do it exactly the same was as in C).

Note that making file/dir is the only accurate way to know, since there can be more complex ACLs, quotas, and race conditions.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.