From a6d64c10862b0747c8c90cb3c9889108b5f3d303 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 17 Jun 2018 19:55:31 -0500 Subject: [PATCH] Handle odd return codes for waccess(..) in src/path.cpp under Solaris --- src/path.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/path.cpp b/src/path.cpp index a5ad76b2d..6cc64048e 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -80,12 +80,21 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path, err = EACCES; } else { switch (errno) { - case ENOENT: - case ENAMETOOLONG: case EACCES: + case ENAMETOOLONG: + case ENOENT: case ENOTDIR: { break; } +#ifdef __sun + //Solaris 5.11 can return any of the following three if the path + //does not exist. Yes, even 0. No, none of this is documented. + case 0: + case EAGAIN: + case EEXIST: { + break; + } +#endif //WSL has a bug where access(2) can return EINVAL //See https://github.com/Microsoft/BashOnWindows/issues/2522 //The only other way EINVAL can happen is if the wrong