From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=Lz2VVoxg; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 4EDE85A0623 for ; Mon, 23 Mar 2026 09:32:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1774254767; bh=kO5a/h6TlYYM4wvFT/dp3b/aEA9CgMvbmEFt63nNBtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lz2VVoxgEhCASCgPXTJ2Kf9UAuPmNQV1AjPSUkMK0B+C8tfI0S00oebOctGW0ByYN A6SLyBMnHPQOlF2+PuLYd54Rk0pqY93l1qh7uwzkavxIdJVly5hFoKOZE9kpvyGEKA esDYFkcpuqtxnFGPgR/+Qsp5u7zNECf6VvqF9EuNEBRUpzfJ92cUCLUZCx8RgOnqt9 vUXfrvjwi3gPvT0IBbg9uKobgGhhLfyvwglXU+WubxuWWzcHBs5lkzkPeqZOFAaVI9 FDJa5ItTRoSIzra+A4oagnhFwz/HfYfzLC4+i9ePq9ncOcDfVOyTfe2WXRotnV8d4f Z7rh94p2xepNw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ffRHz3gXZz4wF0; Mon, 23 Mar 2026 19:32:47 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v3 01/25] conf: runas can be const Date: Mon, 23 Mar 2026 18:37:08 +1100 Message-ID: <20260323073732.3158468-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323073732.3158468-1-david@gibson.dropbear.id.au> References: <20260323073732.3158468-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: WKTX6KYHF3AEGKOUE6FXZJPEDOQT5WBO X-Message-ID-Hash: WKTX6KYHF3AEGKOUE6FXZJPEDOQT5WBO X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Both the runas variable in conf() and the parameter to conf_ugid() can be a const pointer. For some reason cppcheck doesn't catch this now, but does after some upcoming rearrangements for sharing code with the dynamic update tool. Signed-off-by: David Gibson --- conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.c b/conf.c index 940fb9e9..b1ebb4a4 100644 --- a/conf.c +++ b/conf.c @@ -1320,7 +1320,7 @@ static int conf_runas(const char *opt, unsigned int *uid, unsigned int *gid) * @uid: User ID, set on success * @gid: Group ID, set on success */ -static void conf_ugid(char *runas, uid_t *uid, gid_t *gid) +static void conf_ugid(const char *runas, uid_t *uid, gid_t *gid) { /* If user has specified --runas, that takes precedence... */ if (runas) { @@ -1561,8 +1561,8 @@ void conf(struct ctx *c, int argc, char **argv) uint8_t prefix_len_from_opt = 0; unsigned int ifi4 = 0, ifi6 = 0; const char *logfile = NULL; + const char *runas = NULL; size_t logsize = 0; - char *runas = NULL; long fd_tap_opt; int name, ret; uid_t uid; -- 2.53.0