X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=src%2Fmisc.c;fp=src%2Fmisc.c;h=c400bcd5f14f0953c0d87b9982e589bb89d8da3d;hb=3c1a778dfd5bd4434aa6a15730af2e2b995c6ba5;hp=951449eb0c0b035246b02fc50f27d7a7c7e1a49f;hpb=04176c5e3a481e57b4c6b10fdb6b4a5d82f213f2;p=tar diff --git a/src/misc.c b/src/misc.c index 951449e..c400bcd 100644 --- a/src/misc.c +++ b/src/misc.c @@ -422,6 +422,10 @@ maybe_backup_file (const char *file_name, bool this_is_the_archive) if (this_is_the_archive && _remdev (file_name)) return true; + /* Ensure that no previously backed-up file remains in case we + * return early. */ + assign_string (&after_backup_name, 0); + if (stat (file_name, &file_stat)) { if (errno == ENOENT)