2004-03-21 14:05:38 +00:00
|
|
|
#include <u.h>
|
|
|
|
|
#include <libc.h>
|
|
|
|
|
|
|
|
|
|
int
|
2008-07-09 11:53:31 -04:00
|
|
|
opentemp(char *template)
|
2004-03-21 14:05:38 +00:00
|
|
|
{
|
2008-07-09 11:53:31 -04:00
|
|
|
int fd;
|
2004-06-17 21:19:37 +00:00
|
|
|
|
|
|
|
|
fd = mkstemp(template);
|
|
|
|
|
if(fd < 0)
|
|
|
|
|
return -1;
|
2008-07-09 11:53:31 -04:00
|
|
|
remove(template);
|
|
|
|
|
return fd;
|
2004-03-21 14:05:38 +00:00
|
|
|
}
|
2008-07-09 11:53:31 -04:00
|
|
|
|