Get rid of E_OPENDIR.
authorAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 17:45:45 +0000 (19:45 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 17:45:45 +0000 (19:45 +0200)
Return the system error instead.

error.h
fd.c

diff --git a/error.h b/error.h
index 537e7393b3e038d5e380de9512c93965248d11c3..d7a6d03190328bd085f2980795573ce1ae61d694 100644 (file)
--- a/error.h
+++ b/error.h
@@ -411,7 +411,6 @@ extern const char **para_errlist[];
        PARA_ERROR(FGETS, "fgets error"), \
        PARA_ERROR(CHDIR, "failed to change directory"), \
        PARA_ERROR(FCHDIR, "fchdir failed"), \
        PARA_ERROR(FGETS, "fgets error"), \
        PARA_ERROR(CHDIR, "failed to change directory"), \
        PARA_ERROR(FCHDIR, "fchdir failed"), \
-       PARA_ERROR(OPENDIR, "can not open directory"), \
        PARA_ERROR(OPEN, "failed to open file"), \
        PARA_ERROR(CHDIR_PERM, "insufficient permissions to chdir"), \
 
        PARA_ERROR(OPEN, "failed to open file"), \
        PARA_ERROR(CHDIR_PERM, "insufficient permissions to chdir"), \
 
diff --git a/fd.c b/fd.c
index 08a06589bc4294fd6c1c8f9f0ca54fdf407a96e8..0065887d374a4ddba4f2d7a6d4b07aa094c22f1a 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -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 = para_chdir(dirname);
        if (ret < 0)
                goto close_cwd;
-       ret = -E_OPENDIR;
        *dir = 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)
 /* Ignore return value of fchdir() and close(). We're busted anyway. */
 change_to_orig_dir:
        if (cwd)