]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Use the proper type for rlim_t, fixing build failure on x32.
authorAdam Borowski <kilobyte@angband.pl>
Sun, 15 Oct 2017 19:20:34 +0000 (19:20 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 19 Oct 2017 01:22:17 +0000 (21:22 -0400)
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 <kilobyte@angband.pl>
src/lxc/confile.c
src/lxc/confile_legacy.c
src/lxc/confile_utils.c
src/lxc/confile_utils.h

index 913750517c711a3969e6586a81c99a843342e31a..c68f3d4123a9f9d8dc5ff5a6ec04617a9d58735d 100644 (file)
@@ -1442,7 +1442,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;
 
index 93df473764b38503b3a298901fa3837541a1b168..209ae71f38a1f7d5d9cb2393c9e7e96c845de9ee 100644 (file)
@@ -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;
 
index e4917880923d0f809401e2b0ee6c358a915f38a2..59d592d74b56a96c9ad2deccd9733fd21d767265 100644 (file)
@@ -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;
index 2f1079a2c3c31c9e224700ca7594c449315efa56..585b4b52f2343c9d14c5698bbe3f7e50ec1bd71c 100644 (file)
@@ -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 */