On Mon, 19 Feb 2024 13:00:01 GMT, Suchismith Roy <s...@openjdk.org> wrote:

>> Suchi, errno is a global static variable. If some runtime API sets it, it 
>> will continue to have this value until the next runtime call updates it. If 
>> you call dll_load_library, there are many execution paths not passing 
>> dlopen(). So you receive an errno from some unknown runtime API called 
>> before. The correct errno handling is:
>> 
>> errno = 0;
>> runtime_API_which_might_set_errno_in_error_case();
>> error_code = errno;
>> 
>> But what you really need is the result of the `search_file_in_LIBPATH(...)` 
>> call in `Aix_dlopen()`. If it is false, then the error_report starts with 
>> the string "Could not load module . ....."
>> This is called in any case. A `dlopen()` is not called in any case.
>
> Thanks for the detailed explanation @JoKern65 . Do then in this errno check 
> may not be necessary ? or can we still set errno and access it some way ?

In this special case here I would not use errno, but the string returned in 
ebuf, in case the result is nullptr.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16604#discussion_r1494546476

Reply via email to