g10: invalidate the fd cache for keyring.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 24 Apr 2017 22:48:51 +0000 (07:48 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 24 Apr 2017 22:48:51 +0000 (07:48 +0900)
* g10/keyring.c (keyring_search_reset): Don't keep the FD cache.

--

GnuPG-bug-id: 3096
Fixes-commit: 5556eca5acd46983bff0b38a1ffbc2f07fbaba9f
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/keyring.c

index 51b7687..e223f0f 100644 (file)
@@ -663,7 +663,6 @@ keyring_search_reset (KEYRING_HANDLE hd)
 {
     log_assert (hd);
 
-    hd->current.kr = NULL;
     iobuf_close (hd->current.iobuf);
     hd->current.iobuf = NULL;
     hd->current.eof = 0;
@@ -671,6 +670,12 @@ keyring_search_reset (KEYRING_HANDLE hd)
 
     hd->found.kr = NULL;
     hd->found.offset = 0;
+
+    if (hd->current.kr)
+      iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0,
+                   (char*)hd->current.kr->fname);
+    hd->current.kr = NULL;
+
     return 0;
 }