public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* mkdtemp() and HAVE_MKDIR
@ 2023-01-30  9:11 Sebastian Huber
  2023-01-31  9:01 ` Corinna Vinschen
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Huber @ 2023-01-30  9:11 UTC (permalink / raw)
  To: newlib

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?

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mkdtemp() and HAVE_MKDIR
  2023-01-30  9:11 mkdtemp() and HAVE_MKDIR Sebastian Huber
@ 2023-01-31  9:01 ` Corinna Vinschen
  2023-02-01  6:58   ` Sebastian Huber
  0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2023-01-31  9:01 UTC (permalink / raw)
  To: newlib

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mkdtemp() and HAVE_MKDIR
  2023-01-31  9:01 ` Corinna Vinschen
@ 2023-02-01  6:58   ` Sebastian Huber
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2023-02-01  6:58 UTC (permalink / raw)
  To: newlib

On 31.01.23 10:01, Corinna Vinschen wrote:
> 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

Thanks, I will add it to configure.host for RTEMS.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-01  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30  9:11 mkdtemp() and HAVE_MKDIR Sebastian Huber
2023-01-31  9:01 ` Corinna Vinschen
2023-02-01  6:58   ` Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).