Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 215240 Details for
Bug 299390
sys-libs/gdbm-1.8.3-r4: enabling LFS seems to break with db's generated by non-LFS gdbm
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
gdbm non-lfs to lfs db converter
convert.c (text/plain), 1.15 KB, created by
SpanKY
on 2010-01-05 08:06:58 UTC
(
hide
)
Description:
gdbm non-lfs to lfs db converter
Filename:
MIME Type:
Creator:
SpanKY
Created:
2010-01-05 08:06:58 UTC
Size:
1.15 KB
patch
obsolete
>#include <assert.h> >#include <dlfcn.h> >#include <stdio.h> >#include <string.h> >#include <unistd.h> >#include <sys/stat.h> >#include <gdbm.h> > >typeof(gdbm_open) *lfs_gdbm_open; >typeof(gdbm_close) *lfs_gdbm_close; >typeof(gdbm_store) *lfs_gdbm_store; >void lfs_init(void) >{ > void *h = dlopen("libgdbm.so.3", RTLD_LAZY|RTLD_LOCAL); > assert(h != NULL); > lfs_gdbm_open = dlsym(h, "gdbm_open"); > lfs_gdbm_close = dlsym(h, "gdbm_close"); > lfs_gdbm_store = dlsym(h, "gdbm_store"); >} > >int main(int argc, char *argv[]) >{ > datum key, val; > struct stat st; > char *srcf, *dstf; > GDBM_FILE srcdb, dstdb; > assert(argc == 2); > > lfs_init(); > > srcf = argv[1]; > dstf = malloc(strlen(srcf) + 30); > sprintf(dstf, "%s.upgrade.tmp", srcf); > unlink(dstf); > > srcdb = gdbm_open(srcf, 1024, GDBM_NOLOCK | GDBM_READER, 0644, NULL); > assert(srcdb != NULL); > stat(srcf, &st); > dstdb = lfs_gdbm_open(dstf, 1024, GDBM_NOLOCK | GDBM_WRCREAT, st.st_mode, NULL); > assert(dstdb != NULL); > > key = gdbm_firstkey(srcdb); > while (key.dptr) { > val = gdbm_fetch(srcdb, key); > lfs_gdbm_store(dstdb, key, val, GDBM_INSERT); > key = gdbm_nextkey(srcdb, key); > } > > gdbm_close(srcdb); > lfs_gdbm_close(dstdb); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 299390
:
215240
|
215326
|
222571
|
222581