[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error reporting should be improved
From: |
Bob Friesenhahn |
Subject: |
Re: Error reporting should be improved |
Date: |
Tue, 29 Dec 2009 18:25:34 -0600 (CST) |
User-agent: |
Alpine 2.01 (GSO 1266 2009-07-14) |
This note in the Solaris manual page for dlerror() is interesting:
NOTES
The messages returned by dlerror() can reside in a static
buffer that is overwritten on each call to dlerror(). Appli-
cation code should not write to this buffer. Programs want-
ing to preserve an error message should make their own
copies of that message.
The implementation of lt__set_last_error is:
static const char *last_error = 0;
const char *
lt__set_last_error (const char *errormsg)
{
return last_error = errormsg;
}
so the current implementation is not reliable since the buffer pointed
to may be updated several times before it is used. It is also not
thread safe. Note that dlerror() may only be invoked once per error
since calling it a second time returns a null pointer. The Linux
manual page recommends invoking dlerror() to clear any existing error
message before invoking dlsym() (which we are not doing) so a symbol
which has a valid value of zero will result in picking up some old
error message.
It is not clear how to make the interface completely thread safe, but
it is clear that the message needs to be copied immediately to a
private buffer before returning back to the caller in order to make
sure that the error returned is due to invoking a libltdl function.
Bob
--
Bob Friesenhahn
address@hidden, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
- Error reporting should be improved, Xiaoqiang Zhou, 2009/12/27
- Re: Error reporting should be improved, Peter Rosin, 2009/12/29
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/29
- Re: Error reporting should be improved, Peter Rosin, 2009/12/29
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/29
- Re: Error reporting should be improved, Peter Rosin, 2009/12/29
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/29
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/29
- Re: Error reporting should be improved, Peter Rosin, 2009/12/29
- Re: Error reporting should be improved,
Bob Friesenhahn <=
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/29
- Re: Error reporting should be improved, Peter Rosin, 2009/12/30
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/30
- Re: Error reporting should be improved, Peter Rosin, 2009/12/30
- Re: Error reporting should be improved, Bob Friesenhahn, 2009/12/30
- Re: Error reporting should be improved, Peter Rosin, 2009/12/30