summaryrefslogtreecommitdiff
path: root/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-05-12 16:42:50 +0300
committerV3n3RiX <venerix@koprulu.sector>2022-05-12 16:42:50 +0300
commit752d6256e5204b958b0ef7905675a940b5e9172f (patch)
tree330d16e6362a49cbed8875a777fe641a43376cd3 /sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch
parent0c100b7dd2b30e75b799d806df4ef899fd98e1ea (diff)
gentoo resync : 12.05.2022
Diffstat (limited to 'sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch')
-rw-r--r--sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch b/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch
new file mode 100644
index 000000000000..33b5f391ab2a
--- /dev/null
+++ b/sys-apps/coreutils/files/coreutils-9.1-fix-rename-simple-backups.patch
@@ -0,0 +1,38 @@
+https://src.fedoraproject.org/rpms/coreutils/raw/f672fec4364e71c6e5a30d4026d6bdb7cf332eed/f/gnulib-simple-backup-fix.patch
+https://bugs.gnu.org/55029
+
+commit 7347caeb9d902d3fca2c11f69a55a3e578d93bfe
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date: Wed Apr 20 19:34:57 2022 -0700
+
+ backupfile: fix bug when renaming simple backups
+
+ * lib/backupfile.c (backupfile_internal): Fix bug when RENAME
+ and when doing simple backups. Problem reported by Steve Ward in:
+ https://bugs.gnu.org/55029
+
+--- a/lib/backupfile.c
++++ b/lib/backupfile.c
+@@ -332,7 +332,7 @@ backupfile_internal (int dir_fd, char const *file,
+ return s;
+
+ DIR *dirp = NULL;
+- int sdir = AT_FDCWD;
++ int sdir = dir_fd;
+ idx_t base_max = 0;
+ while (true)
+ {
+@@ -371,10 +371,9 @@ backupfile_internal (int dir_fd, char const *file,
+ if (! rename)
+ break;
+
+- int olddirfd = sdir < 0 ? dir_fd : sdir;
+- idx_t offset = sdir < 0 ? 0 : base_offset;
++ idx_t offset = backup_type == simple_backups ? 0 : base_offset;
+ unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
+- if (renameatu (olddirfd, file + offset, sdir, s + offset, flags) == 0)
++ if (renameatu (sdir, file + offset, sdir, s + offset, flags) == 0)
+ break;
+ int e = errno;
+ if (! (e == EEXIST && extended))
+