Set --no-backup-if-mismatch when in --posix mode

When in POSIX mode, the --no-backup-if-mismatch option should be
enabled.  However, this is only true when the POSIXLY_CORRECT
environmant variable is set but not when the --posix command line
option is given.  Fix that by setting backup_if_mismatch after
evaluating the command line arguments.
This commit is contained in:
Andreas Gruenbacher 2024-11-20 23:54:48 +01:00
parent 910fecf695
commit 5bac274507

View File

@ -175,7 +175,6 @@ main (int argc, char **argv)
}
posixly_correct = getenv ("POSIXLY_CORRECT") != 0;
backup_if_mismatch = ! posixly_correct;
patch_get = ((val = getenv ("PATCH_GET"))
? numeric_string (val, true, "PATCH_GET value")
: 0);
@ -197,6 +196,7 @@ main (int argc, char **argv)
if (set_utc && setenv ("TZ", "UTC0", 1) < 0)
pfatal ("setenv");
backup_if_mismatch = ! posixly_correct;
if (make_backups | backup_if_mismatch)
backup_type = get_version (version_control_context, version_control);