Fix mkstemp emulation to not free the template string.

The template argument was strduped unnecessarily and then not used,
and the wrong string was freed.
This commit is contained in:
Johannes Sixt
2006-12-27 15:36:36 +01:00
parent c9467728c6
commit 4720571a2d

View File

@@ -81,15 +81,10 @@ const char *inet_ntop(int af, const void *src,
}
int mkstemp (char *__template)
{
char *temp = xstrdup(__template);
char *filename = mktemp(__template);
int fd;
if (filename == NULL)
return -1;
fd = open(filename, O_RDWR | O_CREAT);
free(filename);
return fd;
return open(filename, O_RDWR | O_CREAT);
}
int gettimeofday(struct timeval *tv, void *tz)
{