conf: pts -> pty_max

parent dfb24c15
...@@ -1523,14 +1523,14 @@ static int lxc_setup_devpts(struct lxc_conf *conf) ...@@ -1523,14 +1523,14 @@ static int lxc_setup_devpts(struct lxc_conf *conf)
const char *default_devpts_mntopts = "gid=5,newinstance,ptmxmode=0666,mode=0620"; const char *default_devpts_mntopts = "gid=5,newinstance,ptmxmode=0666,mode=0620";
char devpts_mntopts[256]; char devpts_mntopts[256];
if (conf->pts <= 0) { if (conf->pty_max <= 0) {
DEBUG("No new devpts instance will be mounted since no pts " DEBUG("No new devpts instance will be mounted since no pts "
"devices are requested"); "devices are requested");
return 0; return 0;
} }
ret = snprintf(devpts_mntopts, sizeof(devpts_mntopts), "%s,max=%d", ret = snprintf(devpts_mntopts, sizeof(devpts_mntopts), "%s,max=%zu",
default_devpts_mntopts, conf->pts); default_devpts_mntopts, conf->pty_max);
if (ret < 0 || (size_t)ret >= sizeof(devpts_mntopts)) if (ret < 0 || (size_t)ret >= sizeof(devpts_mntopts))
return -1; return -1;
......
...@@ -255,8 +255,8 @@ struct lxc_conf { ...@@ -255,8 +255,8 @@ struct lxc_conf {
/* Comma-separated list of lxc.tty.max pty names. */ /* Comma-separated list of lxc.tty.max pty names. */
struct lxc_tty_info ttys; struct lxc_tty_info ttys;
size_t pty_max;
unsigned int pts;
struct lxc_terminal console; struct lxc_terminal console;
struct lxc_rootfs rootfs; struct lxc_rootfs rootfs;
bool close_all_fds; bool close_all_fds;
......
...@@ -974,14 +974,19 @@ static int set_config_personality(const char *key, const char *value, ...@@ -974,14 +974,19 @@ static int set_config_personality(const char *key, const char *value,
static int set_config_pty_max(const char *key, const char *value, static int set_config_pty_max(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
int ret;
unsigned int max = 0;
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
lxc_conf->pts = 0; lxc_conf->pty_max = 0;
return 0; return 0;
} }
if (lxc_safe_uint(value, &lxc_conf->pts) < 0) ret = lxc_safe_uint(value, &max);
if (ret < 0)
return -1; return -1;
lxc_conf->pty_max = max;
return 0; return 0;
} }
...@@ -2905,7 +2910,7 @@ static int get_config_personality(const char *key, char *retv, int inlen, ...@@ -2905,7 +2910,7 @@ static int get_config_personality(const char *key, char *retv, int inlen,
static int get_config_pty_max(const char *key, char *retv, int inlen, static int get_config_pty_max(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data) struct lxc_conf *c, void *data)
{ {
return lxc_get_conf_int(c, retv, inlen, c->pts); return lxc_get_conf_size_t(c, retv, inlen, c->pty_max);
} }
static int get_config_tty_max(const char *key, char *retv, int inlen, static int get_config_tty_max(const char *key, char *retv, int inlen,
...@@ -3682,7 +3687,7 @@ static inline int clr_config_personality(const char *key, struct lxc_conf *c, ...@@ -3682,7 +3687,7 @@ static inline int clr_config_personality(const char *key, struct lxc_conf *c,
static inline int clr_config_pty_max(const char *key, struct lxc_conf *c, static inline int clr_config_pty_max(const char *key, struct lxc_conf *c,
void *data) void *data)
{ {
c->pts = 0; c->pty_max = 0;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment