run-as: clean-up: handle_one_cmd: mark initial uid/gid as const
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Aug 2021 21:30:28 +0000 (17:30 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Aug 2021 21:32:44 +0000 (17:32 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia4fdf5b52a89bc499433550c0de8aeb50d3dea91

src/common/runas.c

index ab43423b1a3fd86ff798d45fb825a4b6e2392dba..db95429b4a0a43ef13aaacf890c726c93e0ed79c 100644 (file)
@@ -1101,8 +1101,8 @@ int handle_one_cmd(struct run_as_worker *worker)
        ssize_t readlen, writelen;
        struct run_as_ret sendret = {};
        run_as_fct cmd;
-       uid_t prev_ruid;
-       gid_t prev_rgid;
+       const uid_t prev_ruid = getuid();
+       const gid_t prev_rgid = getgid();
 
        /*
         * Stage 1: Receive run_as_data struct from the master.
@@ -1140,9 +1140,6 @@ int handle_one_cmd(struct run_as_worker *worker)
                goto end;
        }
 
-       prev_ruid = getuid();
-       prev_rgid = getgid();
-
        ret = demote_creds(prev_ruid, prev_rgid, data.uid, data.gid);
        if (ret < 0) {
                goto write_return;
This page took 0.025936 seconds and 4 git commands to generate.