[BRLTTY] Low-level BrlAPI questions

Aura Kelloniemi kaura.dev at sange.fi
Mon Apr 12 05:58:53 EDT 2021


Hi

On 2021-04-12 at 08:41 +0200, Samuel Thibault <samuel.thibault at ens-lyon.org> wrote:
 > Aura Kelloniemi, le lun. 12 avril 2021 09:33:33 +0300, a ecrit:
 > > Various BrlAPI functions return strings to the caller (in one way or another).
 > > What is the character set of these strings? Can I assume them to be UTF-8 or
 > > ASCII?
 > > 
 > > To give examples: driver names, model identifiers, key names, key code
 > > descriptions, error messages from brlapi_strerror, etc.

 > They are all ASCII.

Ok, thanks.

I researched the error messages case, and I suspect that they
might be encoded in whatever character set in the case of C library errors,
because strerror might return a translated message, which is in the user's
locale.

I also found race conditions from brlapi_strerror. Its result buffer will be
clobbered, if brlapi_strerror is called simultaneously from multiple threads.
This function also calls strerror, which contains the same race condition by
definition. I don't think there is a portable way of fixing it, but on GNU
libc strerror_r should probably be used. gai_strerror probably has the same
issue.

Could a new function brlapi_strerror_r be added that would be re-entrant?

-- 
Aura


More information about the BRLTTY mailing list