]> Savannah Git Hosting - gnulib.git/commit
backupfile: fix numbered backups for XXX/
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 10 Dec 2021 21:31:02 +0000 (13:31 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 10 Dec 2021 21:57:34 +0000 (13:57 -0800)
commitc7bc6fd692d5d6f6419dd155d72f1996e03466a7
treeec036c825a68dcfc7fd9a478fc9c9071937d6271
parent8f3e5e5046055bc00151fe28b50ac438270e23b3
backupfile: fix numbered backups for XXX/

This fixes Bug#52410 reported by Vincent Vermilya.
* lib/backupfile.c (check_extension): Return a bool indicating
whether the original extension was OK.  Caller changed.
(numbered_backup): Require that FILELEN does not count
trailing slashes after a non-slash, and don’t require
that *BUF be null-terminated.  Caller changed.
This fixes a bug where the numbered backup file name for X/ was
incorrectly computed because the trailing slash messed up the code
looking for X.~1~, X.~2~, etc., and this caused numbered_backup
to loop forever.  Also, check that check_extension doesn’t
truncate a file name leading to a different infloop.
ChangeLog
lib/backupfile.c