aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-03-27 15:34:13 +1100
committerStefano Brivio <sbrivio@redhat.com>2026-03-28 14:35:30 +0100
commit57117e48aea21d70eb2fb4103a606c2b28593831 (patch)
tree9afec43069f1e7d6f89d5e3f692142a55065ff48
parentbc872d91765dfd6ff34b0e9a34bce410fac1cef3 (diff)
downloadpasst-57117e48aea21d70eb2fb4103a606c2b28593831.tar
passt-57117e48aea21d70eb2fb4103a606c2b28593831.tar.gz
passt-57117e48aea21d70eb2fb4103a606c2b28593831.tar.bz2
passt-57117e48aea21d70eb2fb4103a606c2b28593831.tar.lz
passt-57117e48aea21d70eb2fb4103a606c2b28593831.tar.xz
passt-57117e48aea21d70eb2fb4103a606c2b28593831.tar.zst
passt-57117e48aea21d70eb2fb4103a606c2b28593831.zip
conf: runas can be const
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--conf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/conf.c b/conf.c
index 940fb9e..b1ebb4a 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;