diff options
author | Werner Koch <[email protected]> | 2006-07-31 10:16:33 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2006-07-31 10:16:33 +0000 |
commit | 064a4a624016ed72fe0aefb73abe95a23bb74dc1 (patch) | |
tree | 5bcd3e8ad5057bbf9a73586b430a6b6e10ff56b3 /util/iobuf.c | |
parent | 2006-07-29 Marcus Brinkmann <[email protected]> (diff) | |
download | gnupg-064a4a624016ed72fe0aefb73abe95a23bb74dc1.tar.gz gnupg-064a4a624016ed72fe0aefb73abe95a23bb74dc1.zip |
Fixed bug 479. Not a real good fix but a reliable one which limits possible
breakage of other partys of the code.
Diffstat (limited to 'util/iobuf.c')
-rw-r--r-- | util/iobuf.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/util/iobuf.c b/util/iobuf.c index 09eda49e7..f6e817c42 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -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 |