1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-15 20:51:27 +01:00

36968: use addmodulefd() to tell the shell about the descriptor of the dbm file

This commit is contained in:
Barton E. Schaefer 2015-10-26 07:25:51 -07:00
parent 8934007f25
commit 609273875d
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2015-10-26 Barton E. Schaefer <schaefer@zsh.org>
* 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 <p.w.stephenson@ntlworld.com>

View file

@ -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;