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