* 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
2022-04-20 Paul Eggert <eggert@cs.ucla.edu>
+ 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
+
gettime-res: more-robust sampling
* lib/gettime-res.c (gettime_res): If adjacent timestamps are
identical search for a differing timestamp. Also, stop collecting
return s;
DIR *dirp = NULL;
- int sdir = AT_FDCWD;
+ int sdir = dir_fd;
idx_t base_max = 0;
while (true)
{
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))