From 5b17bc41befe4b771b46f5a6aa86ed96d4d3bde1 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 5 Dec 2024 17:38:54 +0100 Subject: [PATCH] src/useradd.c: E_BAD_NAME: Use a different error code for bad login names Wrappers like adduser(8) want to do their own stuff if the login name is bad. For that, they need to be able to differentiate such an error. Closes: Suggested-by: Chris Hofstaedtler Cc: Marc 'Zugschlus' Haber Signed-off-by: Alejandro Colomar --- src/useradd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/useradd.c b/src/useradd.c index 7623dabd4a..877471e350 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -201,6 +201,7 @@ static bool home_added = false; #define E_SUB_UID_UPDATE 16 /* can't update the subordinate uid file */ #define E_SUB_GID_UPDATE 18 /* can't update the subordinate gid file */ #endif /* ENABLE_SUBIDS */ +#define E_BAD_NAME 19 /* Bad login name */ #define DGROUP "GROUP" #define DGROUPS "GROUPS" @@ -1549,7 +1550,7 @@ static void process_flags (int argc, char **argv) user_name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); #endif - exit (E_BAD_ARG); + exit (E_BAD_NAME); } if (!dflg) { char *uh;