mkdtemp() and HAVE_MKDIR
Corinna Vinschen
vinschen@redhat.com
Tue Jan 31 09:01:49 GMT 2023
On Jan 30 10:11, Sebastian Huber wrote:
> Hello,
>
> in the mkdtemp() implementation we have:
>
> for (;;)
> {
> #if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4
> if (domkdir)
> {
> #ifdef HAVE_MKDIR
> if (_mkdir_r (ptr, path, 0700) == 0)
> return 1;
> if (_REENT_ERRNO(ptr) != EEXIST)
> return 0;
> #else /* !HAVE_MKDIR */
> _REENT_ERRNO(ptr) = ENOSYS;
> return 0;
> #endif /* !HAVE_MKDIR */
> }
> else
> #endif /* _ELIX_LEVEL */
>
> The HAVE_MKDIR was added by:
>
> commit 12387ab6f77d6ae4fa3d8fdc1756d416a27197dd
> Author: Jeff Johnston <jjohnstn@redhat.com>
> Date: Wed Aug 12 18:22:38 2009 +0000
>
> 2009=08-12 Jeff Johnston <jjohnstn@redhat.com>
>
> * libc/stdio/mktemp.c (_gettemp): Do not call _mkdir_r unless
> HAVE_MKDIR is defined.
>
> Do we really need this check since Newlib provides an mkdir()
> implementation? How should a system set the HAVE_MKDIR define?
I asked the same question back in 2009:
https://sourceware.org/pipermail/newlib/2009/007905.html
and got this reply from Jeff:
https://sourceware.org/pipermail/newlib/2009/007906.html
Corinna
More information about the Newlib
mailing list