apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apr-util/src/dbm apr_dbm.c
Date Tue, 12 Dec 2000 01:05:46 GMT
On Sat, Dec 09, 2000 at 09:35:26AM -0800, rbb@covalent.net wrote:
>... [copying returned datums] ...
> Actually, that's not true.  I have added SDBM support to a couple modules
> recently,

Cool! Well, I'm doubly glad, then, that we will directly export SDBM from
APRUTIL (in addition to using it thru apr_dbm).

> and while everything just works on Linux and FrreBSD, it blows
> up on all Solaris machines.  Basically, on solaris just referencing the
> data in a datum returned by sdbm_fetch will cause a SIGBUS.  This is
> easily reproducable, and is solved by memcpy'ing the data before trying to
> reference it.

The SIGBUS is probably because you're doing something like:

  my_int = *(int *)datum.dptr;

mod_dav had an error like this, which was fixed recently (we were also
SIGBUG'ing on Solaris boxes). The solution was to change the above line to:

  memcpy(&my_int, datum.dptr, sizeof(my_int));

Doing the memcpy on the whole datum (of whatever size(!)) is a brute force
approach to solving the above int-assignment type of problem. And it only
happens to work if the resulting structure is still aligned (mod_dav had
variable length data before the int, so even copying the datum would not
have fully solved the issue)


Greg Stein, http://www.lyra.org/

View raw message