1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Fixed bug 479. Not a real good fix but a reliable one which limits possible

breakage of other partys of the code.
This commit is contained in:
Werner Koch 2006-07-31 10:16:33 +00:00
parent bd5aa4864d
commit 064a4a6240
33 changed files with 947 additions and 576 deletions

View file

@ -1,3 +1,8 @@
2006-07-31 Werner Koch <wk@g10code.com>
* iobuf.c (iobuf_ioctl, fd_cache_invalidate): Allow closing all
open files.
2006-07-29 Marcus Brinkmann <marcus@g10code.de>
* secmem.c (init_pool): Close FD after establishing the mapping.

View file

@ -161,14 +161,31 @@ fd_cache_strcmp (const char *a, const char *b)
}
/*
* Invalidate (i.e. close) a cached iobuf
* Invalidate (i.e. close) a cached iobuf or all iobufs if NULL is
* used for FNAME.
*/
static void
fd_cache_invalidate (const char *fname)
{
CLOSE_CACHE cc;
assert (fname);
if (!fname) {
if( DBG_IOBUF )
log_debug ("fd_cache_invalidate (all)\n");
for (cc=close_cache; cc; cc = cc->next ) {
if ( cc->fp != INVALID_FP ) {
#ifdef HAVE_DOSISH_SYSTEM
CloseHandle (cc->fp);
#else
close(cc->fp);
#endif
cc->fp = INVALID_FP;
}
}
return;
}
if( DBG_IOBUF )
log_debug ("fd_cache_invalidate (%s)\n", fname);
@ -1275,8 +1292,8 @@ iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
else if ( cmd == 2 ) { /* invalidate cache */
if( DBG_IOBUF )
log_debug("iobuf-*.*: ioctl `%s' invalidate\n",
ptrval? (char*)ptrval:"?");
if ( !a && !intval && ptrval ) {
ptrval? (char*)ptrval:"[all]");
if ( !a && !intval ) {
#ifndef FILE_FILTER_USES_STDIO
fd_cache_invalidate (ptrval);
#endif