[CF-Devel] gx11.c

Mark Wedel mwedel at scruz.net
Sat Dec 9 15:59:40 CST 2000


"Pertti Karppinen (OH6KTR)" wrote:
>
     
     
     >
     
      client/gx11.c:6526: the use of tmpnam' is dangerous, better use mkstemp'
     
     >
     
     
     >
     
      man tmpnam on debian unstable gives:
     
     >
     
      BUGS
     
     >
     
             Never use this function. Use tmpfile(3) instead.
     
     >
     
     
     >
     
      Any 'supported platforms' that lacks tmpfile?
     
     
 Right now, tmpfile won't work for what the client needs it for.

 In fact, I believe the reason it is considered unsafe is exactly the reason the
client needs it.  IT is considered unsafe because it generates a supposedly
unique name, but there is no guarantee that name is unique by the time you open
the file.

 The reason the client needs it is because for png support, at the time I
initially wrote it, it would only load from a given filename.  And we need that
filename to pass to the loading function.

 tmpfile doesn't give us a filename, only a file pointer.  So once we close the
file, it is lost.

 Now I did get it to work for crossedit such that I could give it a buffer of
data.  I can look at doing that in the client, and then we shouldn't need tmpnam
(or tmpfiles for that matter) at all.

    
    


More information about the crossfire mailing list