]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: use dummy macros to make it easier to follow sync logic
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 13:13:37 +0000 (14:13 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 29 Jan 2021 13:13:37 +0000 (14:13 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c
src/lxc/sync.h

index a1732a8862ced5f35a48c911e12ccc93197de725..3824672376feedfe8d512056741c81d9108e7c80 100644 (file)
@@ -823,7 +823,7 @@ __noreturn static void do_attach(struct attach_payload *ap)
         * set{g,u}id().
         */
        if (needs_lsm) {
-               if (!sync_wait_fd(ap->ipc_socket, &lsm_fd)) {
+               if (!sync_wait_fd(ap->ipc_socket, ATTACH_SYNC_LSM(&lsm_fd))) {
                        SYSERROR("Failed to receive lsm label fd");
                        goto on_error;
                }
@@ -1265,7 +1265,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
                        lxc_attach_terminal_close_pts(&terminal);
 
                /* Tell grandparent the pid of the pid of the newly created child. */
-               if (!sync_wake_pid(ipc_sockets[1], pid)) {
+               if (!sync_wake_pid(ipc_sockets[1], ATTACH_SYNC_PID(pid))) {
                        /* If this really happens here, this is very unfortunate, since
                         * the parent will not know the pid of the attached process and
                         * will not be able to wait for it (and we won't either due to
@@ -1345,7 +1345,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
        TRACE("Told intermediate process to start initializing");
 
        /* Get pid of attached process from intermediate process. */
-       if (!sync_wait_pid(ipc_sockets[0], &attached_pid))
+       if (!sync_wait_pid(ipc_sockets[0], ATTACH_SYNC_PID(&attached_pid)))
                goto close_mainloop;
 
        TRACE("Received pid %d of attached process in parent pid namespace", attached_pid);
@@ -1382,7 +1382,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
                TRACE("Opened LSM label file descriptor %d", labelfd);
 
                /* Send child fd of the LSM security module to write to. */
-               if (!sync_wake_fd(ipc_sockets[0], labelfd)) {
+               if (!sync_wake_fd(ipc_sockets[0], ATTACH_SYNC_LSM(labelfd))) {
                        SYSERROR("Failed to send lsm label fd");
                        goto close_mainloop;
                }
index 57191c1cbba2dcc26ab9e024f64cbf0a46a8365c..b053d3b027e41b3f6aa94875016f4786aeaa98be 100644 (file)
@@ -29,6 +29,9 @@ enum /* attach */ {
        ATTACH_SYNC_CGROUP      = 0,
 };
 
+#define ATTACH_SYNC_PID(x) (x)
+#define ATTACH_SYNC_LSM(x) (x)
+
 __hidden extern bool lxc_sync_init(struct lxc_handler *handler);
 __hidden extern void lxc_sync_fini(struct lxc_handler *);
 __hidden extern void lxc_sync_fini_parent(struct lxc_handler *);