Subject: Re: mkstemp() core dump
To: Wolfgang Solfrank <ws@tools.de>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 09/02/1999 16:50:04
Wolfgang Solfrank wrote:
> 
> Hi,
> 
> > Fair enough, but in my case path is "/tmp/dico.XXXX" so *(trv-1) really
> > is 'X'. I also tried changing for() to while() so that trv really must
> > point at the NUL at the end of path. I had also assumed that path would
> > be checked in mkstemp which calls gettemp, but no, you're right, sending
> > an empty path should break.
> 
> Hmm, how are you calling mkstemp?  It looks like you are passing a constant
> string as the argument.  This will be placed in read-only memory, but
> mkstemp tries to overwrite the 'X's in there and faults...
> 
> Hope it helps.

That's exactly it! Thank you!

I was calling mkstemp("/tmp/dico.XXXX"); The worst part is, now that you
mention the solution, that I think I fell for the same problem about a
year ago.

Cheers,

Patrick