X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-linkat.c;h=8d179e2fafcbcbad414b5da342802dd8beb1945f;hb=88418d5fd24c99aac393d3e2f564f6939e4e2fe3;hp=9d7a0a7fd2fc5be99d63e93a56580de16ab59b12;hpb=0eec56f883527425b263bcaf1b3591e10b4935ba;p=gnulib.git diff --git a/tests/test-linkat.c b/tests/test-linkat.c index 9d7a0a7fd..8d179e2fa 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -1,5 +1,5 @@ /* Tests of linkat. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,6 +53,17 @@ do_link (char const *name1, char const *name2) return linkat (dfd1, name1, dfd2, name2, flag); } +/* Can we expect that link() and linkat(), when called on a symlink, + increment the link count of that symlink? */ +#if LINK_FOLLOWS_SYMLINKS == 0 +# define EXPECT_LINK_HARDLINKS_SYMLINKS 1 +#elif LINK_FOLLOWS_SYMLINKS == -1 +extern int __xpg4; +# define EXPECT_LINK_HARDLINKS_SYMLINKS (__xpg4 == 0) +#else +# define EXPECT_LINK_HARDLINKS_SYMLINKS 0 +#endif + /* Wrapper to see if two symlinks act the same. */ static void check_same_link (char const *name1, char const *name2) @@ -68,7 +79,7 @@ check_same_link (char const *name1, char const *name2) ASSERT (contents1); ASSERT (contents2); ASSERT (strcmp (contents1, contents2) == 0); - if (!LINK_FOLLOWS_SYMLINKS) + if (EXPECT_LINK_HARDLINKS_SYMLINKS) ASSERT (SAME_INODE (st1, st2)); free (contents1); free (contents2);