]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/tcbfuncs.c: Split conditionals
authorAlejandro Colomar <alx@kernel.org>
Wed, 1 Jan 2025 12:52:09 +0000 (13:52 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 4 Jun 2025 04:25:02 +0000 (23:25 -0500)
This is in preparation for the next commit.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/tcbfuncs.c

index 6e48db4e67a933d61cf31eb43a8eadc900f54620..8ac1b563c66f34cd4527d343ec540a8c04306838 100644 (file)
@@ -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;
        }