Sophie

Sophie

distrib > Mandriva > 10.0-com > x86_64 > by-pkgid > 44031d41bc11dd960f00d933b19ab595 > files > 9

sharutils-4.2.1-14.1.100mdk.src.rpm

--- sharutils-4.2.1.orig/src/unshar.c
+++ sharutils-4.2.1/src/unshar.c
@@ -424,13 +424,15 @@
       }
   else
     {
+#ifdef __MSDOS__
       sprintf (name_buffer, "/tmp/unsh.%05d", (int) getpid ());
       unlink (name_buffer);
 
       if (file = fopen (name_buffer, "w+"), !file)
 	error (EXIT_FAILURE, errno, name_buffer);
-#ifndef __MSDOS__
-      unlink (name_buffer);	/* will be deleted on fclose */
+#else
+      if (file = tmpfile(), !file)
+	error (EXIT_FAILURE, errno, "tmpfile");
 #endif
 
       while (size_read = fread (copy_buffer, 1, sizeof (copy_buffer), stdin),