diff options
Diffstat (limited to 'kbx')
-rw-r--r-- | kbx/keybox-init.c | 20 | ||||
-rw-r--r-- | kbx/keybox-search.c | 5 | ||||
-rw-r--r-- | kbx/keybox.h | 2 |
3 files changed, 27 insertions, 0 deletions
diff --git a/kbx/keybox-init.c b/kbx/keybox-init.c index 6cabaea73..f07ba8db3 100644 --- a/kbx/keybox-init.c +++ b/kbx/keybox-init.c @@ -261,6 +261,26 @@ _keybox_close_file (KEYBOX_HANDLE hd) } +/* Close all the files associated with the resource identified by TOKEN. */ +void +keybox_close_all_files (void *token) +{ + KB_NAME resource = token; + KEYBOX_HANDLE roverhd; + int idx; + + if (!resource) + return; + + for (idx=0; idx < resource->handle_table_size; idx++) + if ((roverhd = resource->handle_table[idx]) && roverhd->fp) + { + es_fclose (roverhd->fp); + roverhd->fp = NULL; + } +} + + /* * Lock the keybox at handle HD, or unlock if YES is false. * Lock the keybox at handle HD, or unlock if YES is false. TIMEOUT diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c index 53ed66b67..263a16617 100644 --- a/kbx/keybox-search.c +++ b/kbx/keybox-search.c @@ -814,6 +814,10 @@ keybox_search_reset (KEYBOX_HANDLE hd) if (hd->fp) { +#if HAVE_W32_SYSTEM + es_fclose (hd->fp); + hd->fp = NULL; +#else if (es_fseeko (hd->fp, 0, SEEK_SET)) { /* Ooops. Seek did not work. Close so that the search will @@ -821,6 +825,7 @@ keybox_search_reset (KEYBOX_HANDLE hd) es_fclose (hd->fp); hd->fp = NULL; } +#endif } hd->error = 0; hd->eof = 0; diff --git a/kbx/keybox.h b/kbx/keybox.h index 565274c10..f90ea1c83 100644 --- a/kbx/keybox.h +++ b/kbx/keybox.h @@ -70,6 +70,8 @@ int keybox_is_writable (void *token); KEYBOX_HANDLE keybox_new_openpgp (void *token, int secret); KEYBOX_HANDLE keybox_new_x509 (void *token, int secret); +void keybox_close_all_files (void *token); + void keybox_release (KEYBOX_HANDLE hd); void keybox_push_found_state (KEYBOX_HANDLE hd); void keybox_pop_found_state (KEYBOX_HANDLE hd); |