[CRIU] [PATCH] zdtm: fix '"makedev" is defined by <sys/sysmacros.h>'

Adrian Reber adrian at lisas.de
Wed Dec 21 04:51:02 PST 2016


From: Adrian Reber <areber at redhat.com>

Compiling zdtm on the latest Fedora rawhide gives errors like this:

ns.c: In function ‘prepare_mntns’:
ns.c:122:13: error: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>. [-Werror]
   if (mknod("/dev/ptmx", 0666 | S_IFCHR, makedev(5, 2)) == 0) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

This commit fixes those errors.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 test/zdtm/lib/ns.c                  | 2 +-
 test/zdtm/static/deleted_dev.c      | 1 +
 test/zdtm/static/overmount_dev.c    | 1 +
 test/zdtm/static/packet_sock_mmap.c | 2 +-
 test/zdtm/static/vt.c               | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index c70c312..9783010 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -7,7 +7,7 @@
 #include <errno.h>
 #include <stdbool.h>
 #include <sys/mount.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/param.h>
diff --git a/test/zdtm/static/deleted_dev.c b/test/zdtm/static/deleted_dev.c
index 2854519..41319b7 100644
--- a/test/zdtm/static/deleted_dev.c
+++ b/test/zdtm/static/deleted_dev.c
@@ -4,6 +4,7 @@
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <sys/sysmacros.h>
 
 #include "zdtmtst.h"
 
diff --git a/test/zdtm/static/overmount_dev.c b/test/zdtm/static/overmount_dev.c
index a691032..a8dc8b8 100644
--- a/test/zdtm/static/overmount_dev.c
+++ b/test/zdtm/static/overmount_dev.c
@@ -4,6 +4,7 @@
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <sys/sysmacros.h>
 
 #include "zdtmtst.h"
 
diff --git a/test/zdtm/static/packet_sock_mmap.c b/test/zdtm/static/packet_sock_mmap.c
index 99b6e2f..edf96c6 100644
--- a/test/zdtm/static/packet_sock_mmap.c
+++ b/test/zdtm/static/packet_sock_mmap.c
@@ -4,7 +4,7 @@ const char *test_doc = "static test for packet sockets mmaps";
 const char *test_author = "Pavel Emelyanov <xemul at parallels.com>";
 
 #include <stdio.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <fcntl.h>
diff --git a/test/zdtm/static/vt.c b/test/zdtm/static/vt.c
index 1726a6f..ab68840 100644
--- a/test/zdtm/static/vt.c
+++ b/test/zdtm/static/vt.c
@@ -7,7 +7,7 @@
 #include <string.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 
 #include "zdtmtst.h"
 
-- 
2.9.3



More information about the CRIU mailing list