$OpenBSD: patch-texk_dvipdfm_psimage_c,v 1.1 2003/02/18 16:04:50 sturm Exp $
--- texk/dvipdfm/psimage.c.orig	Thu Jun 28 21:55:26 2001
+++ texk/dvipdfm/psimage.c	Thu Dec 26 16:14:43 2002
@@ -113,10 +113,18 @@ pdf_obj *ps_include (char *file_name, 
 {
 #ifdef HAVE_SYSTEM
   pdf_obj *result = NULL;
-  char *tmp, *cmd;
+  char *cmd, tmp[30];
   FILE *pdf_file = NULL;
-  /* Get a full qualified tmp name */
-  tmp = tmpnam (NULL);
+  int fd = -1;
+
+  strlcpy(tmp, "/tmp/dvipdfm.XXXXXXXXXXXX", sizeof(tmp));
+  /* Get a full qualified tmp name and create it in one operation */
+  if ((fd=mkstemp(tmp)) == -1) {
+    fprintf(stderr, "\nError opening tmp file %s: %s\n", tmp, strerror(errno));
+    return NULL;
+  }
+  close(fd);
+
   if ((cmd = build_command_line (file_name, tmp))) {
     if (!system (cmd) && (pdf_file = MFOPEN (tmp, FOPEN_RBIN_MODE))) {
       result = pdf_include_page (pdf_file, p, res_name);
@@ -125,10 +133,11 @@ pdf_obj *ps_include (char *file_name, 
     }
     if (pdf_file) {
       MFCLOSE (pdf_file);
-      remove (tmp);
     }
     RELEASE (cmd);
   }
+
+  unlink(tmp);
   return result;
 #else
   fprintf (stderr, "\n\nCannot include PS/EPS files unless you have and enable system() command.\n");
