]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[mysterious problem] disable realpath() resolving of /dev/std* links
authorJuergen Perlinger <perlinger@ntp.org>
Sun, 25 Oct 2020 11:25:51 +0000 (12:25 +0100)
committerJuergen Perlinger <perlinger@ntp.org>
Sun, 25 Oct 2020 11:25:51 +0000 (12:25 +0100)
bk: 5f9560bfyEFd9_tgB0e_ImE4CF9zKQ

tests/libntp/realpath.c

index ca2f38e910a11497fa391989c2e6f5f7f1a3f7a6..c45d363537c5e78e3cfd142a296f63df4bdbd5da 100644 (file)
@@ -68,6 +68,15 @@ void test_DevLinks(void) {
 
        TEST_ASSERT_NOT_NULL_MESSAGE(dfs, "failed to open '/dev' !?!");
        while (NULL != (ent = readdir(dfs))) {
+               /* the /dev/std{in,out,err} symlinks are prone to some
+                * kind of race condition under Linux, so we better skip
+                * them here; running tests in parallel can fail mysteriously
+                * otherwise. (Dunno *how* this could happen, but it
+                * did at some point in time, quite reliably...)
+                */
+               if (!strncmp(ent->d_name, "std", 3))
+                       continue;
+               /* otherwise build the full name & try to resolve: */
                snprintf(nam, sizeof(nam), "/dev/%s", ent->d_name);
                resolved = ntp_realpath(nam);
                TEST_ASSERT_NOT_NULL_MESSAGE(resolved, errMsg("could not resolve '%s'", nam));