From 25d85bdc645073158502d1811b8dc75d6b4ab9d9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 6 Mar 2021 08:09:25 +0100 Subject: [PATCH] path_get_path: Remove error on unknown errno This seems like a good idea, but there isn't anything we or anyone else can *do* in this case. All we ever do is pile on additional errors on the ignore pile, we can't handle any of them differently. The command isn't a thing, so we check the next path. The impetus for this is Cygwin apparently returning a wonderfully useless 0, and it's not even the first one to do so. Fixes #7785 --- src/path.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/path.cpp b/src/path.cpp index 93a4a1599..a387bac8d 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -24,9 +24,6 @@ #include "wcstringutil.h" #include "wutil.h" // IWYU pragma: keep -/// Unexpected error in path_get_path(). -#define MISSING_COMMAND_ERR_MSG _(L"Error while searching for command '%ls'") - // Note that PREFIX is defined in the `Makefile` and is thus defined when this module is compiled. // This ensures we always default to "/bin", "/usr/bin" and the bin dir defined for the fish // programs. Possibly with a duplicate dir if PREFIX is empty, "/", "/usr" or "/usr/". If the PREFIX @@ -81,36 +78,6 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path, return true; } err = EACCES; - } else { - switch (errno) { - 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 - // mode was specified, but we have X_OK hard-coded above. - case EINVAL: { - break; - } - default: { - FLOGF(warning, MISSING_COMMAND_ERR_MSG, next_path.c_str()); - wperror(L"access"); - break; - } - } } }