]> 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 55c134aaa87b40bca139d5cbb32bf3e022f54353..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);
@@ -412,7 +426,7 @@ static int prune_invalid_rows_from_index(struct osl_table *t)
        DEBUG_LOG("unmapping index\n");
        osl_munmap(t->index_map.data, t->index_map.size);
        filename = index_filename(t->desc);
-       ret = para_truncate(filename, t->row_index_size
+       ret = truncate_file(filename, t->row_index_size
                * t->num_invalid_rows);
        free(filename);
        if (ret < 0)
@@ -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);