--- libkmid/midfile.cc.orig	Fri Sep 29 14:30:15 2000
+++ libkmid/midfile.cc	Fri Sep 29 14:33:05 2000
@@ -59,6 +59,23 @@ int uncompressFile(const char *gzname, c
   {
     fprintf(stderr,"ERROR : popen failed : %s\n",cmd);
   }
+#ifdef HAVE_MKSTEMP
+  strcpy(tmpname, "/tmp/KMid.XXXXXXXXXX");
+  int fd = mkstemp(tmpname);
+  if (fd == -1)
+  {
+    pclose(infile);
+    delete cmd;
+    return 1;
+  }
+  FILE *outfile = fdopen(fd, "wb");
+  if (outfile == NULL)
+  {
+    pclose(infile);
+    delete cmd;
+    return 1;
+  }
+#else
   char *tmp=tempnam(NULL,"KMid");
   if (tmp==NULL) 
   {
@@ -74,6 +91,7 @@ int uncompressFile(const char *gzname, c
     delete cmd;
     return 1;
   }
+#endif
   int n=getc(infile);
   if (n==EOF) 
   {
