Blame SOURCES/texinfo-6.1-install-info-use-create-tmp-then-rename-pattern.patch

0603bd
diff -up texinfo-6.1/install-info/install-info.c.orig texinfo-6.1/install-info/install-info.c
0603bd
--- texinfo-6.1/install-info/install-info.c.orig	2016-06-22 09:49:38.766013018 +0200
0603bd
+++ texinfo-6.1/install-info/install-info.c	2016-06-22 14:11:58.673780736 +0200
0603bd
@@ -973,18 +973,23 @@ output_dirfile (char *dirfile, int dir_n
0603bd
   int n_entries_added = 0;
0603bd
   int i;
0603bd
   FILE *output;
0603bd
+  char *dirfile_tmp = NULL;
0603bd
+
0603bd
+  asprintf (&dirfile_tmp, "%s.tmp", dirfile);
0603bd
+  if (!dirfile_tmp)
0603bd
+    xalloc_die ();
0603bd
 
0603bd
   if (compression_program)
0603bd
     {
0603bd
-      char *command = concat (compression_program, ">", dirfile);
0603bd
+      char *command = concat (compression_program, ">", dirfile_tmp);
0603bd
       output = popen (command, "w");
0603bd
     }
0603bd
   else
0603bd
-    output = fopen (dirfile, "w");
0603bd
+    output = fopen (dirfile_tmp, "w");
0603bd
 
0603bd
   if (!output)
0603bd
     {
0603bd
-      perror (dirfile);
0603bd
+      perror (dirfile_tmp);
0603bd
       exit (EXIT_FAILURE);
0603bd
     }
0603bd
 
0603bd
@@ -1095,6 +1100,13 @@ output_dirfile (char *dirfile, int dir_n
0603bd
     pclose (output);
0603bd
   else
0603bd
     fclose (output);
0603bd
+
0603bd
+  if (rename (dirfile_tmp, dirfile) < 0)
0603bd
+    {
0603bd
+      perror (dirfile_tmp);
0603bd
+      exit (EXIT_FAILURE);
0603bd
+    }
0603bd
+  free (dirfile_tmp);
0603bd
 }
0603bd
 
0603bd
 /* Read through the input LINES, to find the section names and the