I am using Tokyo Cabinet for creating persistent storage database.
I am using void *tcbdbget(TCBDB *bdb, const void *kbuf, int ksiz, int *sp);
It gives segfault in tcbdb.h file on *sp = rec->vsiz;.
Is there a bug in Tokyo Cabinet or am I missing something?
Because inserting the record works fine that means all the void pointers are perfectly getting inserted, just lookup has problem.
The insert function is this bool tcbdbput(TCBDB *bdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);.
Tokyo Cabinet (a.k.a TC) expects you pass a valid, non NULL pointer to store the size of the value when you call
tcbdbget, e.g:Passing a NULL pointer could explain the segfault at this precise code section. Please find below a sample code that you can build with
BUG = 1to generate a segfault - withBUG = 0everything works like a charm :)