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"), \
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)