[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dlerror sets errno to ENOSYS
From: |
Diego Nieto Cid |
Subject: |
dlerror sets errno to ENOSYS |
Date: |
Sun, 28 Feb 2016 01:10:27 -0300 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi
I found a strange behaviour in `dlerror` with regard
to errno. When the function is called, it returns the
correct error message but sets errno to ENOSYS.
Thus, future usages of errno don't reflect the real reason
why the previous call to `dlopen` failed.
A little test case for this quirk is attached and can be compiled
with:
LDFLAGS="-ldl" make main
The output it produces is the one listed below.
1 shobj: (nil)
2 dlerror: ./non-existent.so: cannot open shared object file: No such file
or directory
3 errno1: [40000002] No such file or directory
4 errno2: [4000004e] Function not implemented
Line 1 shows `dlopen` actually failed, line 2 is the message returned
by `dlerror`, line 3 is `errno` between those functions and line 4 is
`errno` after `dlerror`.
This issue has two consequences for the console-client:
1. It produces a misleading error message when a driver's shared
library is not found.
2. The drivers will only be looked for in the first directory
specified by "driver path" because the error is no longer ENOENT.
(lines 118-140 of console-client/driver.c)
Having a look at glibc source, dlerror.c file, there's nothing that
could be labeled as unimplemented, at a first glance; just calls to
things like asprintf, strcmp and free.
Any ideas?
Regards,
Diego
--
P.S. I stumbled upon this issue by following the advice in
/etc/defaults/hurd-console of setting KBD to "-d xkb".
main.c
Description: Text Data
- dlerror sets errno to ENOSYS,
Diego Nieto Cid <=