From: Volker Lendecke Date: Wed, 17 Sep 2025 13:49:49 +0000 (-0700) Subject: smbd: Slightly simplify mkdir_internal() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17a23cd6b275ea3a61f4ff40b40fcebf8555bc34;p=thirdparty%2Fsamba.git smbd: Slightly simplify mkdir_internal() Save a few lines by moving the NULL check out of the if-branches. Swap branches to avoid a ! in the condition, makes it easier to read for me. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e62206c71e6..b423fd9fb0c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4587,21 +4587,17 @@ static NTSTATUS mkdir_internal(connection_struct *conn, return NT_STATUS_NO_MEMORY; } SMB_ASSERT(smbd_is_tmpname(tmp_atname->base_name, NULL)); - if (!ISDOT(parent_dir_fname->base_name)) { + if (ISDOT(parent_dir_fname->base_name)) { + tmp_dname = talloc_strdup(frame, tmp_atname->base_name); + } else { tmp_dname = talloc_asprintf(frame, "%s/%s", parent_dir_fname->base_name, tmp_atname->base_name); - if (tmp_dname == NULL) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } - } else { - tmp_dname = talloc_strdup(frame, tmp_atname->base_name); - if (tmp_dname == NULL) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; - } + } + if (tmp_dname == NULL) { + TALLOC_FREE(frame); + return NT_STATUS_NO_MEMORY; } smb_dname->base_name = tmp_dname;