From: Alejandro Colomar Date: Wed, 1 Jan 2025 12:52:09 +0000 (+0100) Subject: lib/tcbfuncs.c: Split conditionals X-Git-Tag: 4.18.0-rc1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=39f41a604bf6262c94191e63a462e52aec01ebdd;p=thirdparty%2Fshadow.git lib/tcbfuncs.c: Split conditionals This is in preparation for the next commit. Signed-off-by: Alejandro Colomar --- diff --git a/lib/tcbfuncs.c b/lib/tcbfuncs.c index 6e48db4e6..8ac1b563c 100644 --- a/lib/tcbfuncs.c +++ b/lib/tcbfuncs.c @@ -435,8 +435,11 @@ shadowtcb_status shadowtcb_move (/*@NULL@*/const char *user_newname, uid_t user_ if (-1 == user_newid) { return SHADOWTCB_SUCCESS; } - if ( (asprintf (&tcbdir, TCB_DIR "/%s", user_newname) == -1) - || (asprintf (&shadow, TCB_FMT, user_newname) == -1)) { + if (asprintf(&tcbdir, TCB_DIR "/%s", user_newname) == -1) { + OUT_OF_MEMORY; + return SHADOWTCB_FAILURE; + } + if (asprintf(&shadow, TCB_FMT, user_newname) == -1) { OUT_OF_MEMORY; return SHADOWTCB_FAILURE; } @@ -540,8 +543,11 @@ shadowtcb_status shadowtcb_create (const char *name, uid_t uid) } } - if ( (asprintf (&dir, TCB_DIR "/%s", name) == -1) - || (asprintf (&shadow, TCB_FMT, name) == -1)) { + if (asprintf(&dir, TCB_DIR "/%s", name) == -1) { + OUT_OF_MEMORY; + return SHADOWTCB_FAILURE; + } + if (asprintf(&shadow, TCB_FMT, name) == -1) { OUT_OF_MEMORY; return SHADOWTCB_FAILURE; }