The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1860
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === There's two new build failures on x32, both due to assumption that some type is identical to 「long」.
From eb0d4ba36171d39c38d4f8a1ff537e7a3abe9bb0 Mon Sep 17 00:00:00 2001 From: Adam Borowski <[email protected]> Date: Sun, 15 Oct 2017 19:09:03 +0000 Subject: [PATCH 1/2] Fix a format string build failure on x32. Both of struct timespec fields are 64-bit on any new architecture, even 32-bit ones. Signed-off-by: Adam Borowski <[email protected]> --- src/lxc/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/log.c b/src/lxc/log.c index 6ca315bd6..4d0643a07 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -222,7 +222,7 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time seconds = (time->tv_sec - d_in_s - h_in_s - (minutes * 60)); /* Make string from nanoseconds. */ - ret = snprintf(nanosec, LXC_NUMSTRLEN64, "%ld", time->tv_nsec); + ret = snprintf(nanosec, LXC_NUMSTRLEN64, "%ld", (long)time->tv_nsec); if (ret < 0 || ret >= LXC_NUMSTRLEN64) return -1; From 7fde53d46c1594e9e426b2c8b700d50b694b5acc Mon Sep 17 00:00:00 2001 From: Adam Borowski <[email protected]> Date: Sun, 15 Oct 2017 19:20:34 +0000 Subject: [PATCH 2/2] 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 <[email protected]> --- src/lxc/confile.c | 2 +- src/lxc/confile_legacy.c | 2 +- src/lxc/confile_utils.c | 4 ++-- src/lxc/confile_utils.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) 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 */
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
