]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - fd.c
Get rid of E_FCHDIR.
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index 08a06589bc4294fd6c1c8f9f0ca54fdf407a96e8..22550286d57747ec90bcdc4aa050c8bea8259e65 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -206,7 +206,7 @@ int para_chdir(const char *path)
  * \param dir Result pointer.
  * \param cwd File descriptor of the current working directory.
  *
- * \return Positive on success, negative on errors.
+ * \return Standard.
  *
  * Opening the current directory (".") and calling fchdir() to return is
  * usually faster and more reliable than saving cwd in some buffer and calling
@@ -236,11 +236,10 @@ int para_opendir(const char *dirname, DIR **dir, int *cwd)
        ret = para_chdir(dirname);
        if (ret < 0)
                goto close_cwd;
-       ret = -E_OPENDIR;
        *dir = opendir(".");
-       if (!*dir)
-               goto change_to_orig_dir;
-       return 1;
+       if (*dir)
+               return 1;
+       ret = -ERRNO_TO_PARA_ERROR(errno);
 /* Ignore return value of fchdir() and close(). We're busted anyway. */
 change_to_orig_dir:
        if (cwd)
@@ -256,12 +255,12 @@ close_cwd:
  *
  * \param fd An open file descriptor
  *
- * \return Positive on success, negative on errors.
+ * \return Standard.
  */
 int para_fchdir(int fd)
 {
        if (fchdir(fd) < 0)
-               return -E_FCHDIR;
+               return -ERRNO_TO_PARA_ERROR(errno);
        return 1;
 }