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 <m...@mcrowe.com>
---
 test/test-openat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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;
-- 
2.30.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#154730): 
https://lists.openembedded.org/g/openembedded-core/message/154730
Mute This Topic: https://lists.openembedded.org/mt/84821456/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to