From 2777a2bfd9d8dca06997a813a94bd26e545eed5c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 28 Oct 2018 16:23:51 -0700 Subject: [PATCH] tar: fix numbered backup bug * src/misc.c (maybe_backup_file): Pass chdir_fd, not AT_FDCWD, to find_backup_file_name. This fixes a bug whereby the wrong backup file name was chosen for numbered backups. --- src/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.c b/src/misc.c index 65833b10..c7e6f2af 100644 --- a/src/misc.c +++ b/src/misc.c @@ -727,7 +727,7 @@ maybe_backup_file (const char *file_name, bool this_is_the_archive) && (S_ISBLK (file_stat.st_mode) || S_ISCHR (file_stat.st_mode))) return true; - after_backup_name = find_backup_file_name (AT_FDCWD, file_name, backup_type); + after_backup_name = find_backup_file_name (chdir_fd, file_name, backup_type); if (! after_backup_name) xalloc_die (); -- 2.47.3