Unverified Commit d6223eea by Adam Borowski Committed by Stéphane Graber

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: 's avatarAdam Borowski <kilobyte@angband.pl>
parent d9d811bf
...@@ -1442,7 +1442,7 @@ static int set_config_prlimit(const char *key, const char *value, ...@@ -1442,7 +1442,7 @@ static int set_config_prlimit(const char *key, const char *value,
{ {
struct lxc_list *iter; struct lxc_list *iter;
struct rlimit limit; struct rlimit limit;
unsigned long limit_value; rlim_t limit_value;
struct lxc_list *limlist = NULL; struct lxc_list *limlist = NULL;
struct lxc_limit *limelem = NULL; struct lxc_limit *limelem = NULL;
......
...@@ -1081,7 +1081,7 @@ extern int set_config_limit(const char *key, const char *value, ...@@ -1081,7 +1081,7 @@ extern int set_config_limit(const char *key, const char *value,
{ {
struct lxc_list *iter; struct lxc_list *iter;
struct rlimit limit; struct rlimit limit;
unsigned long limit_value; rlim_t limit_value;
struct lxc_list *limlist = NULL; struct lxc_list *limlist = NULL;
struct lxc_limit *limelem = NULL; struct lxc_limit *limelem = NULL;
......
...@@ -672,7 +672,7 @@ int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v) ...@@ -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); 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; char *endptr = NULL;
...@@ -683,7 +683,7 @@ bool parse_limit_value(const char **value, unsigned long *res) ...@@ -683,7 +683,7 @@ bool parse_limit_value(const char **value, unsigned long *res)
} }
errno = 0; errno = 0;
*res = strtoul(*value, &endptr, 10); *res = strtoull(*value, &endptr, 10);
if (errno || !endptr) if (errno || !endptr)
return false; return false;
*value = endptr; *value = endptr;
......
...@@ -84,5 +84,5 @@ extern void update_hwaddr(const char *line); ...@@ -84,5 +84,5 @@ extern void update_hwaddr(const char *line);
extern bool new_hwaddr(char *hwaddr); extern bool new_hwaddr(char *hwaddr);
extern int lxc_get_conf_str(char *retv, int inlen, const char *value); 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 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 */ #endif /* __LXC_CONFILE_UTILS_H */
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