aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2021-08-11 18:13:54 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-09 16:35:31 +0100
commitd5a043b4f3519bed69d91f659447038dbf7f8ba6 (patch)
treed1ced0d502c707586ec9673ca2f51a7751e4507a
parentd2e85963e5f60c0530629fc558639e893ceda949 (diff)
downloadpseudo-d5a043b4f3519bed69d91f659447038dbf7f8ba6.zip
pseudo-d5a043b4f3519bed69d91f659447038dbf7f8ba6.tar.gz
pseudo-d5a043b4f3519bed69d91f659447038dbf7f8ba6.tar.bz2
test-openat: Consider device as well as inode number
It just so happens that my /home/mac and /home directories have the same inode number but on different filesystems. This means that test-openat fails with "Recursion failed!" even when run without pseudo. Let's consider both the device number and the inode number before assuming that we've found the same directory again. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--test/test-openat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test-openat.c b/test/test-openat.c
index b710285..df6655a 100644
--- a/test/test-openat.c
+++ b/test/test-openat.c
@@ -25,11 +25,13 @@ int main () {
int fd, dir_fd;
struct stat st;
ino_t ino;
+ dev_t dev;
char *path;
fd = openat(AT_FDCWD, ".", O_DIRECTORY, 0);
fstat(fd, &st);
ino = st.st_ino;
+ dev = st.st_dev;
while (1) {
path = path_of(fd);
@@ -37,7 +39,7 @@ int main () {
dir_fd = openat(fd, "../", O_DIRECTORY, 0);
fstat(dir_fd, &st);
- if (st.st_ino == ino) {
+ if (st.st_ino == ino && st.st_dev == dev) {
if (strcmp(path, "/") == 0) {
//puts("Reached top of tree");
return 0;
@@ -49,6 +51,7 @@ int main () {
free (path);
ino = st.st_ino;
+ dev = st.st_dev;
fd = dir_fd;
}
return 0;