Reject keep values below -1

A keep below -1 made remove_old_backups() delete every backup, including the new one, and then crash.
This commit is contained in:
Fuxino
2026-10-21 22:16:47 +02:00
parent 85bce54b05
commit 535f7a33fe
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -1082,6 +1082,11 @@ def simple_backup() -> int:
ssh_host = args.ssh_host if args.ssh_host is not None else config_args['ssh_host']
ssh_user = args.ssh_user if args.ssh_user is not None else config_args['ssh_user']
if keep < -1:
logger.critical('Invalid number of backups to keep: %d (use -1 to keep all)', keep)
return 6
if (ssh_host is None) != (ssh_user is None):
logger.critical('Both SSH host and SSH user are needed for remote backup')