]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fd.c
fd: Open-code para_chdir().
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index d0de66f41be6008c2d3be5afe6dae002fb06ceb5..cc38f1afba150e0de41fff093c0c5b7ccb24e377 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -304,20 +304,6 @@ out:
        return ret;
 }
 
-/**
- * Check whether a file exists.
- *
- * \param fn The file name.
- *
- * \return True iff file exists.
- */
-bool file_exists(const char *fn)
-{
-       struct stat statbuf;
-
-       return !stat(fn, &statbuf);
-}
-
 /**
  * Set a file descriptor to blocking mode.
  *
@@ -406,22 +392,6 @@ int para_open(const char *path, int flags, mode_t mode)
        return -ERRNO_TO_PARA_ERROR(errno);
 }
 
-/**
- * Wrapper for chdir(2).
- *
- * \param path The specified directory.
- *
- * \return Standard.
- */
-int para_chdir(const char *path)
-{
-       int ret = chdir(path);
-
-       if (ret >= 0)
-               return 1;
-       return -ERRNO_TO_PARA_ERROR(errno);
-}
-
 /**
  * Save the cwd and open a given directory.
  *
@@ -457,9 +427,10 @@ static int para_opendir(const char *dirname, DIR **dir, int *cwd)
                        return ret;
                *cwd = ret;
        }
-       ret = para_chdir(dirname);
-       if (ret < 0)
+       if (chdir(dirname) != 0) {
+               ret = -ERRNO_TO_PARA_ERROR(errno);
                goto close_cwd;
+       }
        *dir = opendir(".");
        if (*dir)
                return 1;