From 6ba5f5f9b8b0d4ab4091922bb6317a3e17e1f227 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 24 Jan 2017 14:06:15 +0000 Subject: [PATCH] Remove a compiler warning in some environments POSIX mandates that `cmsg_len` in `struct cmsghdr` is a `socklen_t`, which is an `unsigned int`. Musl libc as used in Alpine implements this; Glibc ignores the spec and makes it a `size_t` ie `unsigned long`. To avoid the `-Wformat=` warning from the `%lu` on Alpine, cast this to an `unsigned long` always. Signed-off-by: Justin Cormack --- libcontainer/utils/cmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/utils/cmsg.c b/libcontainer/utils/cmsg.c index e77ca69f..0ded4944 100644 --- a/libcontainer/utils/cmsg.c +++ b/libcontainer/utils/cmsg.c @@ -131,7 +131,7 @@ struct file_t recvfd(int sockfd) if (cmsg->cmsg_type != SCM_RIGHTS) error("recvfd: expected SCM_RIGHTS in cmsg: %d", cmsg->cmsg_type); if (cmsg->cmsg_len != CMSG_LEN(sizeof(int))) - error("recvfd: expected correct CMSG_LEN in cmsg: %lu", cmsg->cmsg_len); + error("recvfd: expected correct CMSG_LEN in cmsg: %lu", (unsigned long)cmsg->cmsg_len); fdptr = (int *) CMSG_DATA(cmsg); if (!fdptr || *fdptr < 0)