File wdiff-0.5.2-tempfile.patch of Package wdiff

--- src/wdiff.c
+++ src/wdiff.c
@@ -96,7 +96,6 @@
 char *getenv ();
 FILE *readpipe PARAMS ((const char *, ...));
 FILE *writepipe PARAMS ((const char *, ...));
-char *tmpnam ();
 
 /* Declarations.  */
 
@@ -703,6 +702,7 @@
 split_file_into_words (SIDE *side)
 {
   struct stat stat_buffer;	/* for checking if file is directory */
+  int fd;
 
   /* Open files.  */
 
@@ -714,8 +714,11 @@
 	 this temporary local file.  Once done, prepare it for reading.
 	 We do not need the file name itself anymore.  */
 
-      tmpnam (side->temp_name);
-      side->file = fopen (side->temp_name, "w+");
+      sprintf(side->temp_name,"/tmp/wdiff.XXXXXX");
+      fd = mkstemp(side->temp_name);
+      if (fd == -1) 
+        error(EXIT_OTHER_REASON,errno,side->temp_name);
+      side->file = fdopen (fd, "w+");
       if (side->file == NULL)
 	error (EXIT_OTHER_REASON, errno, side->temp_name);
       if (unlink (side->temp_name) != 0)
@@ -741,8 +744,11 @@
   side->character = getc (side->file);
   side->position = 0;
 
-  tmpnam (side->temp_name);
-  side->temp_file = fopen (side->temp_name, "w");
+  sprintf(side->temp_name,"/tmp/wdiff.XXXXXX");
+  fd = mkstemp(side->temp_name);
+  if (fd == -1)
+    error (EXIT_OTHER_REASON, errno, side->temp_name);
+  side->temp_file = fdopen (fd, "w");
   if (side->temp_file == NULL)
     error (EXIT_OTHER_REASON, errno, side->temp_name);
 
openSUSE Build Service is sponsored by