Skip to content

Commit

Permalink
commands: send ENOSYS response
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 23, 2021
1 parent c071c11 commit ebc548a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lxc/commands.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ebc548a

Please sign in to comment.