[MINC-development] patches for tmpnam

Vicka Corey minc-development@bic.mni.mcgill.ca
Mon, 3 Mar 2003 17:06:51 -0500


Hi -- here are the changes I've put in to get rid of gcc warnings
from calls to tmpnam().  I've commented out the old code and stuck
my changes underneath:

volume_io/Prog_utils/files.c:
  line 810:
    /*char     tmp_name[L_tmpnam+1]; */   
    /*(void) tmpnam( tmp_name );*/

    char tmp_name[11];
    strcpy (tmp_name, "tempXXXXXX");
    mkstemp(tmp_name);

  line 843:
    /*char     tmp_name[L_tmpnam+1];*/    
    char     tmp_name[11];

  line 904:
        /*(void) tmpnam( tmp_name ); */   
        strcpy (tmp_name, "tempXXXXXX");
        mkstemp(tmp_name);


volume_io/Volumes/volume_cache.c:
  line 863:
    /*char       tmp_name[L_tmpnam+1];*/  
    char        tmp_name[11];

  line 875:
        /*(void) tmpnam( tmp_name );*/
        strcpy(tmp_name, "tempXXXXXX");
        (void) mkstemp(tmp_name);


I suspect I will also want to do something about the call to tempnam in
libsrc/netcdf_convenience.c as well, but haven't yet (I think it will be
slightly less trivial to do and keep TMPDIR functionality).

--vicka