diff --git a/src/patch.c b/src/patch.c index 81c7a02..3269a80 100644 --- a/src/patch.c +++ b/src/patch.c @@ -1971,6 +1971,24 @@ output_files (struct stat const *st) gl_list_clear (files_to_output); } + +static void +forget_output_files (void) +{ + gl_list_iterator_t iter = gl_list_iterator (files_to_output); + const void *elt; + + while (gl_list_iterator_next (&iter, &elt, NULL)) + { + const struct file_to_output *file_to_output = elt; + + safe_unlink (file_to_output->from); + } + gl_list_iterator_free (&iter); + gl_list_clear (files_to_output); +} + + /* Fatal exit with cleanup. */ void @@ -2002,5 +2020,6 @@ cleanup (void) remove_if_needed (TMPPATNAME, &TMPPATNAME_needs_removal); remove_if_needed (TMPEDNAME, &TMPEDNAME_needs_removal); remove_if_needed (TMPREJNAME, &TMPREJNAME_needs_removal); - output_files (NULL); + // output_files (NULL); + forget_output_files(); } diff --git a/src/util.c b/src/util.c index 1cc08ba..e911cc8 100644 --- a/src/util.c +++ b/src/util.c @@ -566,7 +566,7 @@ create_file (char const *file, int open_flags, mode_t mode, { char *f; if (errno != try_makedirs_errno) - pfatal ("Can't create file %s", quotearg (file)); + pfatal ("Cannot create file %s", quotearg (file)); f = xstrdup (file); makedirs (f); free (f);