diff --git a/src/lxc/commands.c b/src/lxc/commands.c index f6a9e4fda..e57a64f33 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -402,8 +402,10 @@ pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath) static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req, struct lxc_handler *handler) { + intmax_t pid = handler->pid; + struct lxc_cmd_rsp rsp = { - .data = INTMAX_TO_PTR(handler->pid) + .data = INTMAX_TO_PTR(pid) }; return lxc_cmd_rsp_send(fd, &rsp); diff --git a/src/lxc/macro.h b/src/lxc/macro.h index 96d737267..8c8c91a6e 100644 --- a/src/lxc/macro.h +++ b/src/lxc/macro.h @@ -155,13 +155,30 @@ * + * \0 = 1 */ -#define LXC_PROC_PID_FD_LEN (6 + INTTYPE_TO_STRLEN(pid_t) + 4 + INTTYPE_TO_STRLEN(int) + 1) +#define LXC_PROC_PID_FD_LEN \ + (6 + INTTYPE_TO_STRLEN(pid_t) + 4 + INTTYPE_TO_STRLEN(int) + 1) -/* /proc/pid-to-str/status\0 = (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) */ -#define LXC_PROC_STATUS_LEN (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) +/* /proc/ = 6 + * + + * = INTTYPE_TO_STRLEN(pid_t) + * + + * /status = 7 + * + + * \0 = 1 + */ +#define LXC_PROC_STATUS_LEN (6 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) -/* /proc/pid-to-str/attr/current = (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) */ -#define LXC_LSMATTRLEN (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) +/* /proc/ = 6 + * + + * = INTTYPE_TO_STRLEN(pid_t) + * + + * /attr/ = 6 + * + + * /current = 8 + * + + * \0 = 1 + */ +#define LXC_LSMATTRLEN (6 + INTTYPE_TO_STRLEN(pid_t) + 6 + 8 + 1) #define LXC_CMD_DATA_MAX (MAXPATHLEN * 2)