]> Git Repo - qemu.git/commitdiff
tests/tcg/multiarch: fix 32bit linux-test on 64bit host
authorLaurent Vivier <[email protected]>
Tue, 13 Nov 2018 17:54:37 +0000 (18:54 +0100)
committerAlex Bennée <[email protected]>
Wed, 14 Nov 2018 11:07:06 +0000 (11:07 +0000)
Fix:

  TEST    linux-test on i386
  .../tests/tcg/multiarch/linux-test.c:201: readdir

readdir() calls getdents64() to have the list of the entries in a
directory, and getdents64() can return 64bit d_off values (with ext4,
for instance) that will not fit in the 32bit d_off field of the
readdir() dirent structure.

To avoid that, use readdir64() to use a 64bit d_off field too.

Signed-off-by: Laurent Vivier <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
tests/tcg/multiarch/linux-test.c

index e80eccc0cec7473e4e8609a5443c70f913cb7082..fa4243fc042632f67c3688b5a60be5c56759a556 100644 (file)
@@ -83,7 +83,7 @@ static void test_file(void)
     struct utimbuf tbuf;
     struct iovec vecs[2];
     DIR *dir;
-    struct dirent *de;
+    struct dirent64 *de;
     /* TODO: make common tempdir creation for tcg tests */
     char template[] = "/tmp/linux-test-XXXXXX";
     char *tmpdir = mkdtemp(template);
@@ -186,7 +186,7 @@ static void test_file(void)
         error("opendir");
     len = 0;
     for(;;) {
-        de = readdir(dir);
+        de = readdir64(dir);
         if (!de)
             break;
         if (strcmp(de->d_name, ".") != 0 &&
This page took 0.028467 seconds and 4 git commands to generate.