mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-26 22:11:46 +00:00
Merge pull request #2579 from brauner/2018-08-31/int64_t_pids
macro: calculate buffer lengths correctly
This commit is contained in:
commit
b0f3050884
@ -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);
|
||||
|
@ -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
|
||||
* +
|
||||
* <pid-as-str> = 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
|
||||
* +
|
||||
* <pid-as-str> = 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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user