From: Adam Borowski Date: Sun, 15 Oct 2017 19:20:34 +0000 (+0000) Subject: Use the proper type for rlim_t, fixing build failure on x32. X-Git-Tag: lxc-3.0.0.beta1~212^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1860%2Fhead;p=thirdparty%2Flxc.git Use the proper type for rlim_t, fixing build failure on x32. Assuming a particular width of a type (or equivalence with "long") doesn't work everywhere. On new architectures, LFS/etc is enabled by default, making rlim_t same as rlim64_t even if long is only 32-bit. Not sure how you handle too big values -- you may want to re-check the strtoull part. Signed-off-by: Adam Borowski --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 4850e4ce5..3567525da 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -1453,7 +1453,7 @@ static int set_config_prlimit(const char *key, const char *value, { struct lxc_list *iter; struct rlimit limit; - unsigned long limit_value; + rlim_t limit_value; struct lxc_list *limlist = NULL; struct lxc_limit *limelem = NULL; diff --git a/src/lxc/confile_legacy.c b/src/lxc/confile_legacy.c index 93df47376..209ae71f3 100644 --- a/src/lxc/confile_legacy.c +++ b/src/lxc/confile_legacy.c @@ -1081,7 +1081,7 @@ extern int set_config_limit(const char *key, const char *value, { struct lxc_list *iter; struct rlimit limit; - unsigned long limit_value; + rlim_t limit_value; struct lxc_list *limlist = NULL; struct lxc_limit *limelem = NULL; diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c index e49178809..59d592d74 100644 --- a/src/lxc/confile_utils.c +++ b/src/lxc/confile_utils.c @@ -672,7 +672,7 @@ int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v) return snprintf(retv, inlen, "%d", v); } -bool parse_limit_value(const char **value, unsigned long *res) +bool parse_limit_value(const char **value, rlim_t *res) { char *endptr = NULL; @@ -683,7 +683,7 @@ bool parse_limit_value(const char **value, unsigned long *res) } errno = 0; - *res = strtoul(*value, &endptr, 10); + *res = strtoull(*value, &endptr, 10); if (errno || !endptr) return false; *value = endptr; diff --git a/src/lxc/confile_utils.h b/src/lxc/confile_utils.h index 2f1079a2c..585b4b52f 100644 --- a/src/lxc/confile_utils.h +++ b/src/lxc/confile_utils.h @@ -84,5 +84,5 @@ extern void update_hwaddr(const char *line); extern bool new_hwaddr(char *hwaddr); extern int lxc_get_conf_str(char *retv, int inlen, const char *value); extern int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v); -extern bool parse_limit_value(const char **value, unsigned long *res); +extern bool parse_limit_value(const char **value, rlim_t *res); #endif /* __LXC_CONFILE_UTILS_H */