1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

scd: Change the order of applications when accessed.

* scd/app.c (select_application): Move the app to top.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2017-03-27 13:56:02 +09:00
parent 0848cfcce7
commit d58275703f

View File

@ -316,7 +316,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
size_t serialno_bin_len) size_t serialno_bin_len)
{ {
gpg_error_t err = 0; gpg_error_t err = 0;
app_t a; app_t a, a_prev = NULL;
*r_app = NULL; *r_app = NULL;
@ -375,6 +375,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
&& !memcmp (a->serialno, serialno_bin, a->serialnolen)) && !memcmp (a->serialno, serialno_bin, a->serialnolen))
break; break;
unlock_app (a); unlock_app (a);
a_prev = a;
} }
if (a) if (a)
@ -384,6 +385,12 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
{ {
a->ref_count++; a->ref_count++;
*r_app = a; *r_app = a;
if (a_prev)
{
a_prev->next = a->next;
a->next = app_top;
app_top = a;
}
} }
unlock_app (a); unlock_app (a);
} }