- /* Now perform some cross-directory checks. Skip everything else on
- mingw. */
- if (HAVE_SYMLINK)
- {
- const char *contents = "don't matter!";
- ssize_t exp = strlen (contents);
-
- /* Create link while cwd is '.', then read it in '..'. */
- ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == 0);
- errno = 0;
- ASSERT (symlinkat (contents, dfd, BASE "link") == -1);
- ASSERT (errno == EEXIST);
- ASSERT (chdir ("..") == 0);
- errno = 0;
- ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == -1);
- ASSERT (errno == ENOENT);
- ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
- ASSERT (strncmp (contents, buf, exp) == 0);
- ASSERT (unlinkat (dfd, BASE "link", 0) == 0);
-
- /* Create link while cwd is '..', then read it in '.'. */
- ASSERT (symlinkat (contents, dfd, BASE "link") == 0);
- ASSERT (fchdir (dfd) == 0);
- errno = 0;
- ASSERT (symlinkat (contents, AT_FDCWD, BASE "link") == -1);
- ASSERT (errno == EEXIST);
- buf[0] = '\0';
- ASSERT (readlinkat (AT_FDCWD, BASE "link", buf, sizeof buf) == exp);
- ASSERT (strncmp (contents, buf, exp) == 0);
- buf[0] = '\0';
- ASSERT (readlinkat (dfd, BASE "link", buf, sizeof buf) == exp);
- ASSERT (strncmp (contents, buf, exp) == 0);
- ASSERT (unlink (BASE "link") == 0);
- }
-