]> git.tuebingen.mpg.de Git - osl.git/blobdiff - fsck.c
Inline para_fchdir(), move it to fsck.c and rename it.
[osl.git] / fsck.c
diff --git a/fsck.c b/fsck.c
index 574509fcebdda24c52a8a1e45d0f4c94f6c6eef3..b5e4fdbe16e0fc593e303de69de8e521b845ed31 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -208,6 +208,20 @@ static int uint32_compare(const struct osl_object *obj1, const struct osl_object
        return 0;
 }
 
+/**
+ * A wrapper for fchdir().
+ *
+ * \param fd An open file descriptor.
+ *
+ * \return Standard.
+ */
+static inline int __fchdir(int fd)
+{
+       if (fchdir(fd) < 0)
+               return -ERRNO_TO_ERROR(errno);
+       return 1;
+}
+
 /**
  * Traverse the given directory recursively.
  *
@@ -263,7 +277,7 @@ static int for_each_file_in_dir(const char *dirname,
        ret = 1;
 out:
        closedir(dir);
-       ret2 = para_fchdir(cwd_fd);
+       ret2 = __fchdir(cwd_fd);
        if (ret2 < 0 && ret >= 0)
                ret = ret2;
        close(cwd_fd);
@@ -1126,7 +1140,7 @@ static int check_all_tables(char *db_dir)
                        break;
        }
        closedir(dir);
-       ret2 = para_fchdir(cwd_fd);
+       ret2 = __fchdir(cwd_fd);
        if (ret2 < 0 && ret >= 0)
                ret = ret2;
        close(cwd_fd);