@@ -20,7 +20,7 @@ inline ::fast_io::install_path get_module_install_path_from_argv0(char const *ar
2020{
2121 if (!argv0) [[unlikely]]
2222 {
23- throw_posix_error ();
23+ throw_posix_error (EINVAL );
2424 }
2525
2626 ::fast_io::install_path ret;
@@ -36,8 +36,8 @@ inline ::fast_io::install_path get_module_install_path_from_argv0(char const *ar
3636 char path_list_separator[8 ] = " :" ; // could be ":; "
3737 if (argv0[0 ] == path_separator)
3838 {
39- [[maybe_unused]] auto const unused1{::fast_io::noexcept_call (realpath, argv0, newpath)};
40- if (auto status{::fast_io::noexcept_call (access, newpath, F_OK)}; !status)
39+ [[maybe_unused]] auto const unused1{::fast_io::noexcept_call (:: realpath, argv0, newpath)};
40+ if (auto status{::fast_io::noexcept_call (:: access, newpath, F_OK)}; !status)
4141 {
4242 newpath[PATH_MAX - 1 ] = 0 ;
4343 ret.module_name = ::fast_io::u8concat_fast_io (::fast_io::mnp::code_cvt_os_c_str (newpath));
@@ -57,16 +57,16 @@ inline ::fast_io::install_path get_module_install_path_from_argv0(char const *ar
5757 }
5858 else
5959 {
60- throw_posix_error (status );
60+ throw_posix_error ();
6161 }
6262 }
6363 else if (__builtin_strchr (argv0, static_cast <int >(path_separator)))
6464 {
65- [[maybe_unused]] auto const unused1{::fast_io::noexcept_call (getcwd, newpath2, PATH_MAX)};
66- ::fast_io::noexcept_call (strncat, newpath2, path_separator_as_string, PATH_MAX + 256 );
67- ::fast_io::noexcept_call (strncat, newpath2, argv0, PATH_MAX + 256 );
68- [[maybe_unused]] auto const unused2{::fast_io::noexcept_call (realpath, newpath2, newpath)};
69- if (auto status{::fast_io::noexcept_call (access, newpath, F_OK)};!status)
65+ [[maybe_unused]] auto const unused1{::fast_io::noexcept_call (:: getcwd, newpath2, PATH_MAX)};
66+ ::fast_io::noexcept_call (:: strncat, newpath2, path_separator_as_string, PATH_MAX + 256 );
67+ ::fast_io::noexcept_call (:: strncat, newpath2, argv0, PATH_MAX + 256 );
68+ [[maybe_unused]] auto const unused2{::fast_io::noexcept_call (:: realpath, newpath2, newpath)};
69+ if (auto status{::fast_io::noexcept_call (:: access, newpath, F_OK)};!status)
7070 {
7171 newpath[PATH_MAX - 1 ] = 0 ;
7272 ret.module_name = ::fast_io::u8concat_fast_io (::fast_io::mnp::code_cvt_os_c_str (newpath));
@@ -93,15 +93,15 @@ inline ::fast_io::install_path get_module_install_path_from_argv0(char const *ar
9393 {
9494 char *saveptr;
9595 char *pathitem;
96- char *save_path{::fast_io::noexcept_call (getenv, " PATH" )};
97- for (pathitem = ::fast_io::noexcept_call (strtok_r, save_path, path_list_separator, &saveptr); pathitem;
98- pathitem = ::fast_io::noexcept_call (strtok_r, nullptr , path_list_separator, &saveptr))
96+ char *save_path{::fast_io::noexcept_call (:: getenv, " PATH" )};
97+ for (pathitem = ::fast_io::noexcept_call (:: strtok_r, save_path, path_list_separator, &saveptr); pathitem;
98+ pathitem = ::fast_io::noexcept_call (:: strtok_r, nullptr , path_list_separator, &saveptr))
9999 {
100- ::fast_io::noexcept_call (strncpy, newpath2, pathitem, PATH_MAX + 256 );
101- ::fast_io::noexcept_call (strncat, newpath2, path_separator_as_string, PATH_MAX + 256 );
102- ::fast_io::noexcept_call (strncat, newpath2, argv0, PATH_MAX + 256 );
100+ ::fast_io::noexcept_call (:: strncpy, newpath2, pathitem, PATH_MAX + 256 );
101+ ::fast_io::noexcept_call (:: strncat, newpath2, path_separator_as_string, PATH_MAX + 256 );
102+ ::fast_io::noexcept_call (:: strncat, newpath2, argv0, PATH_MAX + 256 );
103103 [[maybe_unused]] auto const unused1{::realpath (newpath2, newpath)};
104- if (!::fast_io::noexcept_call (access, newpath, F_OK))
104+ if (!::fast_io::noexcept_call (:: access, newpath, F_OK))
105105 {
106106 newpath[PATH_MAX - 1 ] = 0 ;
107107 ret.module_name = ::fast_io::u8concat_fast_io (::fast_io::mnp::code_cvt_os_c_str (newpath));
@@ -120,7 +120,7 @@ inline ::fast_io::install_path get_module_install_path_from_argv0(char const *ar
120120 return ret;
121121 }
122122 } // end for
123- throw_posix_error ();
123+ throw_posix_error (EINVAL );
124124
125125 } // end else
126126}
0 commit comments