fix -xdev behavior in the presence of two or more nested mount points
authorPaul Fox <pgf@brightstareng.com>
Thu, 6 Sep 2007 17:45:16 +0000 (17:45 -0000)
committerPaul Fox <pgf@brightstareng.com>
Thu, 6 Sep 2007 17:45:16 +0000 (17:45 -0000)
on the command line, e.g. "find / /boot -xdev".

findutils/find.c

index 21584681bbe81d859a08359c9b7748467dfeb75c..f3167a083769441a3b6b35f98deaa2dd6ddae9bf 100644 (file)
@@ -383,9 +383,11 @@ static int fileAction(const char *fileName, struct stat *statbuf, void *userData
 #if ENABLE_FEATURE_FIND_XDEV
        if (S_ISDIR(statbuf->st_mode) && xdev_count) {
                for (i = 0; i < xdev_count; i++) {
-                       if (xdev_dev[i] != statbuf->st_dev)
-                               return SKIP;
+                       if (xdev_dev[i] == statbuf->st_dev)
+                               break;
                }
+               if (i == xdev_count)
+                       return SKIP;
        }
 #endif
        i = exec_actions(actions, fileName, statbuf);