From 09156a37fad2aa874b4f71b993bafa8902a8bad2 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 10 Oct 2007 19:45:45 +0200 Subject: [PATCH 1/1] Get rid of E_OPENDIR. Return the system error instead. --- error.h | 1 - fd.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/error.h b/error.h index 537e7393..d7a6d031 100644 --- 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(OPENDIR, "can not open directory"), \ PARA_ERROR(OPEN, "failed to open file"), \ PARA_ERROR(CHDIR_PERM, "insufficient permissions to chdir"), \ diff --git a/fd.c b/fd.c index 08a06589..0065887d 100644 --- 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 = -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) -- 2.39.2