| delorie.com/archives/browse.cgi | search |
| 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=XYtege8P+KoRAPV8NylJj1c94OcVCzgvNIMF+WNnImk=; | |
| b=z+J0SvyC8eNZSWbtOtRFd8PBeGO5Xwxkj2vLCVGKeaK+w4vtukAmfcYC3z8kemW3zY | |
| 5OT5Ae55Rp5LsFKGI825+BJm74OgJ5crByKOg9iAQv3k98C275QsyDxIuxLswUsu1w3B | |
| GMgrcAW5HmOAG5zG/m+tW1dTBukXERTSKldDf6u9lXp77/RYoUEtoCpaPq77npr5HOjx | |
| 8bSCb/wu8IZl7WrYE4YZE57iuLGIndpzYj9fXVhBzaZhqKeOM2AdYtRCb8nlHzeYEp4I | |
| aBXB6Ur7zvLVzaf8h8gphO59XmK/SCBAlsFeX9w1bWYo5OJwmf+grpxmwsopotehziT4 | |
| qMmA== | |
| MIME-Version: | 1.0 |
| X-Received: | by 10.50.49.44 with SMTP id r12mr31976595ign.41.1398192856711; |
| Tue, 22 Apr 2014 11:54:16 -0700 (PDT) | |
| In-Reply-To: | <83wqeh9pwq.fsf@gnu.org> |
| References: | <CAA2C=vBuWHmVNrRAcGDSXYLc8Eg_xsyMVszPzrxqHGrpVq2vmw AT mail DOT gmail DOT com> |
| <83wqeh9pwq DOT fsf AT gnu DOT org> | |
| Date: | Tue, 22 Apr 2014 21:54:16 +0300 |
| Message-ID: | <CAA2C=vD_97x3-A0Y52JDfbmmFiuVzF_Ufub6imhmuhTsdsNr4w@mail.gmail.com> |
| Subject: | Re: [PATCH] break xstat.c into pieces |
| From: | Ozkan Sezer <sezeroz AT gmail DOT com> |
| To: | djgpp-workers AT delorie DOT com |
| 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 |
On 4/22/14, Eli Zaretskii <eliz AT gnu DOT org> wrote:
>> Date: Tue, 22 Apr 2014 14:11:36 +0300
>> From: Ozkan Sezer <sezeroz AT gmail DOT com>
>>
>> The following patch breaks xstat.c into smaller pieces, so that, e.g.
>> mkdir() doesn't pull in unnecessary dependencies such as ctime.o.
>
> I'd rather change 'mkdir' so that it doesn't call 'access', but only
> its small subset that is needed for testing the D_OK flag. That
> sounds like a smaller and more localized change to me. WDYT?
>
Changing mkdir() is the first thing that conmes to mind, but there
is also _is_executable(), which is a public func through sys/stat.h,
an it relies on _djstat_flags which is in xstat.c at present.
I suggest that we chop xstat.c into pieces _and_ change mkdir() too.
A simple patch for mkdir() itself is inlined below. Note, however,
this eliminates the _fixpath() operation present in access(): I do
not know how necessary that is.
Index: mkdir.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/mkdir.c,v
retrieving revision 1.7
diff -u -p -r1.7 mkdir.c
--- 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)
errno = EEXIST;
else
errno = save_errno;
--
O.S.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |