[lxc-devel] [lxc/master] build: fix build on android (and ppc)

tych0 on Github lxc-bot at linuxcontainers.org
Tue Mar 15 18:04:01 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 602 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160315/8cf755d1/attachment.bin>
-------------- next part --------------
From f03280a7609a24f9003472af3e5f6dd1244c5033 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 15 Mar 2016 12:01:36 -0600
Subject: [PATCH] build: fix build on android (and ppc)

The problem here is that dev_t on most platforms is `long unsigned`, but on
android (and ppc?) it's `long long unsigned`. Let's just upcast to `long
long unsigned` and use that format string to keep the compilers happy.

Safety first!

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/criu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index c83845e..a745806 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -732,7 +732,9 @@ static int save_tty_major_minor(char *directory, struct lxc_container *c, char *
 		return -1;
 	}
 
-	ret = snprintf(tty_id, len, "tty[%lx:%lx]", sb.st_rdev, sb.st_dev);
+	ret = snprintf(tty_id, len, "tty[%llx:%llx]",
+					(long long unsigned) sb.st_rdev,
+					(long long unsigned) sb.st_dev);
 	if (ret < 0 || ret >= sizeof(path)) {
 		ERROR("snprintf'd too many characters: %d", ret);
 		return -1;


More information about the lxc-devel mailing list