[RFA:] add _mkdir_r, fixing fallout from "add mkstemps, mkdtemp"
Jeff Johnston
jjohnstn@redhat.com
Sun Aug 16 10:12:00 GMT 2009
Corinna Vinschen wrote:
> On Aug 12 14:30, Jeff Johnston wrote:
>
>> Hans-Peter Nilsson wrote:
>>
>>>> Date: Wed, 12 Aug 2009 12:26:14 -0400
>>>> From: Jeff Johnston
>>>> Actually, I don't agree with this. The better way to handle this is
>>>> to protect the code with HAVE_MKDIR and put in the libnosys logic
>>>> directly if it is not provided.
>>>> [...]
>>>>
>>> This would work for me, too...but IIUC the reent.h part of the
>>> patch I posted would still be be needed.
>>>
>>>
>> Yes, that's correct. I have checked in your newlib pieces with my
>> patch added to mktemp.c. There is no libnosys part required so that is
>> left out. Let me know if I missed anything.
>>
>
> Where is the configure check for HAVE_MKDIR?
>
>
There isn't. It is variable to set in configure.host like HAVE_RENAME
and HAVE_FCNTL.
> As is, the patch breaks (not only) Cygwin because HAVE_MKDIR is nowhere
> configured. As a result, the code path for all targets will be the one
> setting ptr->_errno to ENOSYS. How do we add a check for HAVE_MKDIR
> for cross builds?
>
>
A previous note in the discussion about this problem noted that Cygwin
was overriding the function that exercised the _mkdir_r call which is
why Cygwin wasn't getting a link exception since _mkdir_r wasn't wrapped
yet. The same would be true for any other platform using the function
previously as there was no _mkdir_r. If Cygwin is not overriding and is
supplying a _mkdir syscall, then Cygwin should set HAVE_MKDIR in
configure.host. If it doesn't have a mkdir syscall, then the current
output is correct.
> There's also a typo in the file in the name of the function mkdtemp:
>
> Index: libc/stdio/mktemp.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/stdio/mktemp.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 mktemp.c
> --- libc/stdio/mktemp.c 12 Aug 2009 18:22:38 -0000 1.12
> +++ libc/stdio/mktemp.c 12 Aug 2009 22:06:21 -0000
> @@ -301,7 +301,7 @@ _DEFUN(mkstemp, (path),
>
> # if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4
> char *
> -_DEFUN(mkdemp, (path),
> +_DEFUN(mkdtemp, (path),
> char *path)
> {
> return (_gettemp (_REENT, path, (int *) NULL, 1, 0) ? path : NULL);
>
>
>
Feel free to check that in if you add HAVE_MKDIR to configure.host or
I'll do it if it turns out there isn't an issue.
> Corinna
>
>
More information about the Newlib
mailing list