]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: send ENOSYS response
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 23 Feb 2021 13:22:22 +0000 (14:22 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 23 Feb 2021 15:15:32 +0000 (16:15 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c

index f8d4b7ef39d064b563dce4ceff90a9c842bceaab..6fcf376daaa93101409828a2752a47d745af493e 100644 (file)
@@ -1616,6 +1616,16 @@ static int lxc_cmd_get_limiting_cgroup2_fd_callback(int fd,
                                                  true);
 }
 
+static int lxc_cmd_rsp_send_enosys(int fd, int id)
+{
+       struct lxc_cmd_rsp rsp = {
+               .ret = -ENOSYS,
+       };
+
+       __lxc_cmd_rsp_send(fd, &rsp);
+       return syserrno_set(-ENOSYS, "Invalid command id %d", id);
+}
+
 static int lxc_cmd_process(int fd, struct lxc_cmd_req *req,
                           struct lxc_handler *handler,
                           struct lxc_epoll_descr *descr)
@@ -1651,7 +1661,7 @@ static int lxc_cmd_process(int fd, struct lxc_cmd_req *req,
        };
 
        if (req->cmd >= LXC_CMD_MAX)
-               return log_trace_errno(-1, EINVAL, "Invalid command id %d", req->cmd);
+               return lxc_cmd_rsp_send_enosys(fd,  req->cmd);
 
        return cb[req->cmd](fd, req, handler, descr);
 }