mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-03 07:12:48 +00:00
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.
travis-ci: success for zdtm: fix '"makedev" is defined by <sys/sysmacros.h>'
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
60 lines
1.1 KiB
C
60 lines
1.1 KiB
C
#define _GNU_SOURCE
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
#include <sys/sysmacros.h>
|
|
|
|
#include "zdtmtst.h"
|
|
|
|
const char *test_doc = "Check c/r of a virtual terminal";
|
|
const char *test_author = "Ruslan Kuprieiev <kupruser@gmail.com>";
|
|
|
|
char *filename;
|
|
TEST_OPTION(filename, string, "file name", 1);
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct stat st1, st2;
|
|
int fd;
|
|
|
|
test_init(argc, argv);
|
|
|
|
if (mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, makedev(4, 5))) {
|
|
pr_perror("Can't create virtual terminal %s", filename);
|
|
return 1;
|
|
}
|
|
|
|
fd = open(filename, O_RDONLY);
|
|
if (fd < 0) {
|
|
pr_perror("Open virtual terminal %s failed", filename);
|
|
return 1;
|
|
}
|
|
|
|
if (fstat(fd, &st1)) {
|
|
pr_perror("Can't stat %s virtual terminal", filename);
|
|
return 1;
|
|
}
|
|
|
|
test_daemon();
|
|
test_waitsig();
|
|
|
|
if (fstat(fd, &st2)) {
|
|
pr_perror("Can't stat %s virtual terminal", filename);
|
|
return 1;
|
|
}
|
|
|
|
if (st1.st_rdev != st2.st_rdev) {
|
|
fail("Virtual terminal rdev mismatch %x != %x on %s",
|
|
(int)st1.st_rdev, (int)st2.st_rdev,
|
|
filename);
|
|
return 1;
|
|
}
|
|
|
|
pass();
|
|
return 0;
|
|
}
|