From 609273875d3fb911c20806aeb7c4d558e698a7f2 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 26 Oct 2015 07:25:51 -0700 Subject: 36968: use addmodulefd() to tell the shell about the descriptor of the dbm file --- ChangeLog | 3 +++ Src/Modules/db_gdbm.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a55439df4..df70cbd45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-10-26 Barton E. Schaefer + * 36968: Src/Modules/db_gdbm.c: use addmodulefd() to tell the + shell about the descriptor of the dbm file + * 36956: Src/mem.c: revert 34451, mmap() is too slow on MacOS 2015-10-26 Peter Stephenson diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c index 76d4751bf..032963262 100644 --- a/Src/Modules/db_gdbm.c +++ b/Src/Modules/db_gdbm.c @@ -106,7 +106,9 @@ bin_ztie(char *nam, char **args, Options ops, UNUSED(int func)) } dbf = gdbm_open(resource_name, 0, read_write, 0666, 0); - if(!dbf) { + if(dbf) + addmodulefd(gdbm_fdesc(dbf), FDT_INTERNAL); + else { zwarnnam(nam, "error opening database file %s", resource_name); return 1; } @@ -114,6 +116,7 @@ bin_ztie(char *nam, char **args, Options ops, UNUSED(int func)) if (!(tied_param = createspecialhash(pmname, &getgdbmnode, &scangdbmkeys, pmflags))) { zwarnnam(nam, "cannot create the requested parameter %s", pmname); + fdtable[gdbm_fdesc(dbf)] = FDT_UNUSED; gdbm_close(dbf); return 1; } @@ -319,8 +322,10 @@ gdbmuntie(Param pm) GDBM_FILE dbf = (GDBM_FILE)(pm->u.hash->tmpdata); HashTable ht = pm->u.hash; - if (dbf) /* paranoia */ + if (dbf) { /* paranoia */ + fdtable[gdbm_fdesc(dbf)] = FDT_UNUSED; gdbm_close(dbf); + } ht->tmpdata = NULL; -- cgit 1.4.1