On 04/05/2020 02:51, Theodore Y. Ts'o wrote:
On Sun, May 03, 2020 at 02:00:25PM +0100, Jonny Grant wrote:
Hi
I noticed that mkdir() returns EEXIST if a directory already exists.
strerror(EEXIST) text is "File exists"
Can ext4_find_dest_de() be amended to return EISDIR if a directory already
exists? This will make the error message clearer.
No; this will confuse potentially a large number of existing programs.
Also, the current behavior is required by POSIx and the Single Unix
Specification standards.
https://pubs.opengroup.org/onlinepubs/009695399/
Regards,
- Ted
Thank you
This is the POSIX mkdir():
https://pubs.opengroup.org/onlinepubs/009695399/functions/mkdir.html
How about adding an improved mkdir to POSIX and the Linux kernel? Let's call it mkdir2()
It has one more error, for EISDIR
[EEXIST]
The named file exists.
[EISDIR]
Directory with that name exists.
I'm tempted to suggest this new function mkdir2() returns 0 on success, or an error number directly number. That would
do away with 'errno' for this as well.
Regards, Jonny