X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=CatMssf42ZgexVfVjB60N4mUdCdMkrjvJXeg4nfLhUc=; b=EuJzJ0IUFD9griQc8q+AtXBskCFzYc8CMjZ6v+GFQXUuGsz3Pdw4Tl/JhGx3uKVw9z epS8Uu/9cefprrcd6LQce/B+aV1y21rmK7fEKO2vFwOgPMiEjAxHtvwSOt/U32a+0jXv YGDiAe7fE4rk8iCGIAiNAbqxJoIJjM7RHzqIK9tkl7UhEcPX++hIDANG36CztYfUvG/8 op/btYYAyhlnG0EdWyGbqOCovTiusQUF3kK4ogyxh15cesPoorzGVreqEE6loDL/JQMk 49f/OVv8ZqNUp9vEpCRXCiCtxbRIMtGfjuvuOofJWmOWqSynzjlg6bXgfpHrT8hK6mU8 YopA== MIME-Version: 1.0 X-Received: by 10.50.136.168 with SMTP id qb8mr430175igb.13.1398196215111; Tue, 22 Apr 2014 12:50:15 -0700 (PDT) In-Reply-To: <83r44p9mjr.fsf@gnu.org> References: <83wqeh9pwq DOT fsf AT gnu DOT org> <83vbu19o4f DOT fsf AT gnu DOT org> <83r44p9mjr DOT fsf AT gnu DOT org> Date: Tue, 22 Apr 2014 22:50:15 +0300 Message-ID: Subject: Re: [PATCH] break xstat.c into pieces From: Ozkan Sezer To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=UTF-8 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 4/22/14, Eli Zaretskii wrote: >> Date: Tue, 22 Apr 2014 22:27:56 +0300 >> From: Ozkan Sezer >> >> >> I suggest that we chop xstat.c into pieces _and_ change mkdir() too. >> > >> > I see no need to chop, just get _djstat_flags out of there. >> > >> >> OK, then I suggest moving those two flags into a new statbits.c > > Maybe just into crt1.c. It's just one int, so doesn't deserve a > separate file, and no one will complain about the code bloat of 4 > bytes. > Well, if you really really truly obliged to not create a new file, then yes :(( >> >> --- mkdir.c 2 Oct 2011 02:40:11 -0000 1.7 >> >> +++ mkdir.c 22 Apr 2014 18:50:40 -0000 >> >> @@ -73,7 +73,8 @@ do_mkdir: >> >> { >> >> /* see if the directory existed, in which case >> >> we should return EEXIST - DJ */ >> >> - if (access(mydirname, D_OK) == 0) >> >> + if ((attr = _chmod(dir_name, 0)) != -1 && >> >> + attr & 0x10) >> > >> > Not enough: _chmod doesn't resolve symlinks (assuming we want to >> > return EEXIST for symlinks to directories, that is -- what does Posix >> > say?). >> > >> >> On linux, 'man 2 mkdir' says: >> "EEXIST pathname already exists (not necessarily as a directory). >> This includes the case where pathname is a symbolic link, dangling >> or not." > > So we need to resolve symlinks. > >> Note that what we presently have already resolves the symlinks even >> though we are passing mydirname to access() and not dir_name, >> because access() does resolve symlinks. > > Right you are, sorry for the noise. > OK, leaving things to you guys.