[RFA:] add _mkdir_r, fixing fallout from "add mkstemps, mkdtemp"

Jeff Johnston jjohnstn@redhat.com
Wed Aug 12 18:30:00 GMT 2009


Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Hans-Peter Nilsson on 8/11/2009 5:40 PM:
>   
>>> +#if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 2
>>> +      if (domkdir)
>>> +	{
>>> +	  if (_mkdir_r (ptr, path, 0700) == 0)
>>> +	    return 1;
>>> +	  if (ptr->_errno != EEXIST)
>>> +	    return 0;
>>> +	}
>>> +      else
>>> +#endif /* _ELIX_LEVEL */
>>>       
>> So, where did you find that _mkdir_r you're calling?  Were there
>> missing parts to the above patches?  Would those parts look like
>> the patches below, adding necessary framework and stub for the
>> mkdir syscall?
>>     
>
> I just assumed that it worked like any other syscall, but you are correct
> that newlib has not yet wrapped mkdir.  It worked for me on cygwin because
> cygwin overrides mk*temp* in order to use a more secure random string
> generation function, so this particular block wasn't getting compiled
> under cygwin.
>
>   

>> With this patch, I can use today's newlib with test-suite
>> results fixed (the same as before the above patch) for cris-elf.
>> Nope, didn't test it anywhere else.  Not trying to raise the bar.
>>
>> Ok to commit?
>>     
>
> I can't approve it, but it looks obvious to me.
>
>   
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.  Otherwise, this forces platforms to either 
implement _mkdir or link with libnosys which is unreasonable.  There are 
other optional syscalls already being checked for in newlib.   I have 
put together a patch which I attached to this note.  Let me know what 
you think.
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mktemp.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20090812/aeae3ea4/attachment.ksh>


More information about the Newlib mailing list