From: Tobias Stoeckmann Date: Tue, 6 Jan 2026 17:20:33 +0000 (+0100) Subject: login-utils: Use /etc/passwd- as backup file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea3857615df887ec9a1dbbbcca7ba89a2482cbd5;p=thirdparty%2Futil-linux.git login-utils: Use /etc/passwd- as backup file The name /etc/passwd- is used as backup file by shadow and systemd. Let's join the group and use /etc/passwd- instead of /etc/passwd.OLD as well. One backup file on a system is enough. Signed-off-by: Tobias Stoeckmann --- diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c index 55fb174d0..e48e4cedc 100644 --- a/login-utils/setpwnam.c +++ b/login-utils/setpwnam.c @@ -138,9 +138,9 @@ int setpwnam(struct passwd *pwd, const char *prefix) } /* we don't care if we can't remove the backup file */ - unlink(PASSWD_FILE ".OLD"); + unlink(PASSWD_FILE "-"); /* we don't care if we can't create the backup file */ - ignore_result(link(PASSWD_FILE, PASSWD_FILE ".OLD")); + ignore_result(link(PASSWD_FILE, PASSWD_FILE "-")); /* we DO care if we can't rename to the passwd file */ if (rename(tmpname, PASSWD_FILE) < 0) goto fail; diff --git a/login-utils/vipw.c b/login-utils/vipw.c index 5d8644c82..30a4e1701 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -145,7 +145,7 @@ static void pw_write(void) { char tmp[FILENAMELEN + 4]; - snprintf(tmp, sizeof(tmp), "%s%s", orig_file, ".OLD"); + snprintf(tmp, sizeof(tmp), "%s%s", orig_file, "-"); unlink(tmp); if (link(orig_file, tmp))