s!/etc/slackware-release!/etc/slackware-version! (reported by bubulak)
[util-vserver.git] / util-vserver / src / fstool.c
index d493831..e686f8c 100644 (file)
@@ -42,29 +42,6 @@ struct Arguments const *             global_args = 0;
 
 int wrapper_exit_code = 1;
 
-bool
-checkForRace(int fd, char const * name, struct stat const *exp_st)
-{
-  struct stat          st;
-  
-  if (fstat(fd, &st)==-1) {
-    perror("fstat()");
-    return false;
- }
-
-  if (st.st_dev  != exp_st->st_dev ||
-      st.st_ino  != exp_st->st_ino ||
-      st.st_mode != exp_st->st_mode) {
-    close(fd);
-    WRITE_MSG(2, "race while visiting '");
-    WRITE_STR(2, name);
-    WRITE_MSG(2, "'\n");
-    exit(2);
-  }
-
-  return true;
-}
-
 inline static bool
 isSpecialDir(char const *d)
 {
@@ -179,8 +156,13 @@ processFile(char const *path)
   }
 
   if (S_ISDIR(st.st_mode) && !global_args->do_display_dir) {
+    int                cur_dir = Eopen(".", O_RDONLY, 0);
+    uint64_t   ret;
     Echdir(path);
-    return iterateFilesystem(path);
+    ret = iterateFilesystem(path);
+    Efchdir(cur_dir);
+    Eclose(cur_dir);
+    return ret;
   }
   else
     return handleFile(path, path) ? 0 : 1;