I'm surprised your example doesn't segfault. My Linux man page
says explicitly that the template should not be a string constant
but must be a character array, i.e. use
char t1[] = "/tmp/clisp-x-io-XXXXXX";
char t2[] = "/tmp/clisp-x-io-XXXXXX";
char t3[] = "/tmp/clisp-x-io-XXXXXX";
mkstemp(t1);
mkstemp(t2);
mkstemp(t3);
instead.
Tony Richardson
p.s. Don't use
char *t1 = "/tmp/clisp-x-io-XXXXXX";
either. It's not the same. Constant strings like this and in your
original program can be stored in a read-only segment and so
are not necessarily writeable.
"Sam Steingold" wrote:
> Hi,
> it appears that mkstemp() returns a temp FD pointing to the same file:
> mkstemp ("/tmp/clisp-x-io-XXXXXX");
> ==> "/tmp/clisp-x-io-000592"
> mkstemp ("/tmp/clisp-x-io-XXXXXX");
> ==> "/tmp/clisp-x-io-000592"
> mkstemp ("/tmp/clisp-x-io-XXXXXX");
> ==> "/tmp/clisp-x-io-000592"
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/