[CRIU] [PATCH] tty: use PRIx64 to print dev_t

Andrey Vagin avagin at openvz.org
Tue Dec 29 15:13:24 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

dev_t is %ul on x86_64 and %ull on arm32

tty.c: In function 'get_tty_driver':
tty.c:247:2: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'dev_t' [-Werror=format=]
  snprintf(id, sizeof(id), "tty[%lx:%lx]", rdev, dev);

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tty.c b/tty.c
index a38de47..1643ef0 100644
--- a/tty.c
+++ b/tty.c
@@ -244,7 +244,7 @@ struct tty_driver *get_tty_driver(dev_t rdev, dev_t dev)
 	int major, minor;
 	char id[42];
 
-	snprintf(id, sizeof(id), "tty[%lx:%lx]", rdev, dev);
+	snprintf(id, sizeof(id), "tty[%"PRIx64":%"PRIx64"]", rdev, dev);
 	if (external_lookup_id(id) || inherit_fd_lookup_id(id) >= 0)
 		return &ext_driver;
 
-- 
2.4.3



More information about the CRIU mailing list