[CRIU] [PATCH 6/6] pie: add %z support to pie's printf

Kir Kolyshkin kir at openvz.org
Mon Feb 22 18:44:16 PST 2016


This is handy whenever we want to print size_t or ssize_t.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/pie/log-simple.c | 3 +++
 criu/pie/parasite.c   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/pie/log-simple.c b/criu/pie/log-simple.c
index 1cc877d..c33cc1b 100644
--- a/criu/pie/log-simple.c
+++ b/criu/pie/log-simple.c
@@ -225,6 +225,9 @@ void sbuf_printf(struct simple_buf *b, const char *format, va_list args)
 			s++;
 			if (*s == 'l')
 				s++;
+		} else if (*s == 'z') {
+			along = (sizeof(size_t) > sizeof(int));
+			s++;
 		}
 
 		switch (*s) {
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index 2466665..5c6898f 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -521,7 +521,7 @@ static int __parasite_daemon_reply_ack(unsigned int cmd, int err)
 	m = ctl_msg_ack(cmd, err);
 	ret = sys_sendto(tsock, &m, sizeof(m), 0, NULL, 0);
 	if (ret != sizeof(m)) {
-		pr_err("Sent only %d bytes while %lu expected\n", ret, sizeof(m));
+		pr_err("Sent only %d bytes while %zu expected\n", ret, sizeof(m));
 		return -1;
 	}
 
-- 
2.5.0



More information about the CRIU mailing list