LFS 5.0 Patch-2.5.4 Chapt 5 mktemp ?

Allard Welter allard at nospam.nl
Sat Jan 24 06:00:57 PST 2004


On Saturday 24 January 2004 02:14, Ronald Hummelink wrote:
> On Sat, 2004-01-24 at 00:36, Allard Welter wrote:
> > mktemp and mkstemp do the same thing

And I wrote some other things as well such as:
A match and a flamethrower do the same thing (both start fires)

>
> BZZZZZT!!
>
> WRONG!
>
> You shall not continue for the microwave ;-)
:~/ :-| #-)

>
> #include <stdlib.h>
> char *mktemp(char *template);
>
> #include <stdlib.h>
> int mkstemp(char *template);
>
> See these functions have a rather different return type, this makes
> their use quite different.
          ^^^
Indeed, you are quite correct and for completeness here's the reference I was 
too lazy to look up last night:
http://epoxy.mrs.umn.edu/doc/glibc-doc/html/chapters_14.html#SEC296

>
> The idea between the 2 functions is similar, however the usage is
> different, which is why a 1 on 1 replace will cause non-functionality.

I had a _sober_ look this morning - the return value is not used so 
replacement is trivial (read on before quoting me). The problem comes later 
because mktemp and mkstemp _behave_ differently despite _doing_ the same 
thing. The temp file gets opened quite safely with a O_EXCL flag in 
patch-2.5.4.

> Don't give the impression it is any easier.

I wrote:
Seeing the program I'm working on at the moment is not co-operating, perhaps 
I'll take a look - bit tipsy right now, but I'll try to remember.

If you interpret that as me thinking it would be easy you are mistaken. I had 
a look, I'm not getting involved any further, I learnt some stuff I would 
otherwise not have, thankyou for the additional clarification.

> --
> Linux is like a small snowball rolling downhill. Microsoft is just
> waiting down the mountain...

agreed,
Best regards - Allard.

-- 
allard at quicknet.nl




More information about the lfs-support mailing list