aboutsummaryrefslogtreecommitdiffstats
path: root/util/iobuf.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-07-31 10:16:33 +0000
committerWerner Koch <[email protected]>2006-07-31 10:16:33 +0000
commit064a4a624016ed72fe0aefb73abe95a23bb74dc1 (patch)
tree5bcd3e8ad5057bbf9a73586b430a6b6e10ff56b3 /util/iobuf.c
parent2006-07-29 Marcus Brinkmann <[email protected]> (diff)
downloadgnupg-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 '')
-rw-r--r--util/iobuf.c25
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