Subject: mkstemp() core dump
To: None <current-users@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: current-users
Date: 09/02/1999 14:04:26
Am I the only one having problems with mkstemp?

Program received signal SIGSEGV, Segmentation fault.
0x8053c9e in __gettemp (path=0x805dcc6 "/tmp/dico.XXXX", doopen=0xefbfc204, 
    domkdir=0) at /usr/src/lib/libc/stdio/gettemp.c:83
83                      *--trv = xtra[0];

As usual, the code in gettemp.c looks fine...

        /* Move to end of path and count trailing X's. */
        for (trv = path; *trv; ++trv) */   
                if (*trv == 'X')
                        xcnt++;
                else    
                        xcnt = 0;

        /* Use at least one from xtra.  Use 2 if more than 6 X's. */
        if (*(trv-1) == 'X')
Dies here->     *--trv = xtra[0];  
        if (xcnt > 6 && *(trv-1) == 'X')
                *--trv = xtra[1];

and changing to *(--trv) didn't help.

Cheers,

Patrick