Patch based off code from: Martin Pitt http://bugs.gentoo.org/106105 --- util/texindex.c +++ util/texindex.c @@ -390,11 +390,12 @@ maketempname (int count) { static char *tempbase = NULL; + char *tempname; char tempsuffix[10]; + int fd; if (!tempbase) { - int fd; tempbase = concat (tempdir, "txidxXXXXXX"); fd = mkstemp (tempbase); @@ -403,7 +404,12 @@ } sprintf (tempsuffix, ".%d", count); - return concat (tempbase, tempsuffix); + tempname = concat (tempbase, tempsuffix); + fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600); + if (fd == -1) + pfatal_with_name (tempname); + close (fd); + return tempname; }