[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6e172ae-ba19-f303-3aa9-a388adba8cb0@jguk.org>
Date: Wed, 27 May 2020 22:25:43 +0100
From: Jonny Grant <jg@...k.org>
To: "Theodore Y. Ts'o" <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: Re: /fs/ext4/namei.c ext4_find_dest_de()
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
Powered by blists - more mailing lists