File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -934,9 +934,9 @@ end function stdlib_is_directory
934934
935935end function is_directory
936936
937- ! A helper function to get the result of the C function `strerror` .
938- ! `strerror ` is a function provided by `<string.h>`.
939- ! It returns a string describing the meaning of `errno` in the C header `<errno.h>`
937+ ! A helper function to get the string describing an error from C functions .
938+ ! If `winapi ` is false or not present, uses `strerror` provided by `<string.h>`
939+ ! Otherwise, uses `strerror` on unix and `FormatMessageA` on windows.
940940function c_get_strerror (winapi ) result(str)
941941 character (len= :), allocatable :: str
942942 logical , optional , intent (in ) :: winapi
Original file line number Diff line number Diff line change 1212#endif /* ifdef _WIN32 */
1313
1414// Wrapper to get the string describing a system syscall error.
15- // Uses `strerr` on unix.
15+ // Always Uses `strerr` on unix.
1616// if `winapi` is `false`, uses the usual `strerr` on windows.
17- // If `winapi` is `false `, uses `FormatMessage `(from windows.h) on windows.
17+ // If `winapi` is `true `, uses `FormatMessageA `(from windows.h) on windows.
1818char * stdlib_strerror (size_t * len , bool winapi ){
1919
2020 if (winapi ) {
2121#ifdef _WIN32
2222 LPSTR err = NULL ;
2323 DWORD dw = GetLastError ();
2424
25- FormatMessage (
25+ FormatMessageA (
2626 FORMAT_MESSAGE_ALLOCATE_BUFFER |
2727 FORMAT_MESSAGE_FROM_SYSTEM |
2828 FORMAT_MESSAGE_IGNORE_INSERTS ,
You can’t perform that action at this time.
0 commit comments