]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: port lxc_cmd_get_init_pid() to new helpers
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Feb 2021 09:17:19 +0000 (10:17 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 25 Feb 2021 11:03:25 +0000 (12:03 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c

index ba4fc81b914f3cae004f93c438006800abcfb370..91d65a7f7d7740baac17cf855a3eb5a900cc221e 100644 (file)
@@ -555,16 +555,11 @@ static int validate_string_request(int fd, const struct lxc_cmd_req *req)
 pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath)
 {
        bool stopped = false;
-       pid_t pid = -1;
-       struct lxc_cmd_rr cmd = {
-               .req = {
-                       .cmd = LXC_CMD_GET_INIT_PID
-               },
-               .rsp = {
-                       .data = PID_TO_PTR(pid)
-               }
-       };
        int ret;
+       pid_t pid;
+       struct lxc_cmd_rr cmd;
+
+       lxc_cmd_init(&cmd, LXC_CMD_GET_INIT_PID);
 
        ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
        if (ret < 0)