patch-common_tmpfile_c 493 B

123456789101112131415161718
  1. $OpenBSD: patch-common_tmpfile_c,v 1.1 2007/10/26 22:00:31 ajacoutot Exp $
  2. --- common/tmpfile.c.orig Tue May 9 10:06:46 1995
  3. +++ common/tmpfile.c Fri Oct 26 23:58:56 2007
  4. @@ -90,7 +90,12 @@ void tmpfile_free()
  5. char *tmpfile_create()
  6. {
  7. TMP_FILE *ptr, *tf;
  8. - char *filename = strdup(tmpnam(NULL));
  9. + char xxx[40];
  10. + char *filename;
  11. +
  12. + sprintf(xxx, "/tmp/tmpf.XXXXXXXX");
  13. + close(mkstemp(xxx));
  14. + filename = strdup(xxx);
  15. if(filename == NULL)
  16. return(NULL);