[Pkg-gnupg-commit] [gnupg2] 80/124: scd: Change the order of applications when accessed.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 5 15:55:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit d58275703f035e8cfd58cd1c2d0d5ac7dc59e110
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Mar 27 13:56:02 2017 +0900

    scd: Change the order of applications when accessed.
    
    * scd/app.c (select_application): Move the app to top.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
---
 scd/app.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scd/app.c b/scd/app.c
index 472adc7..044bb1d 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -316,7 +316,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
                     size_t serialno_bin_len)
 {
   gpg_error_t err = 0;
-  app_t a;
+  app_t a, a_prev = 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))
         break;
       unlock_app (a);
+      a_prev = a;
     }
 
   if (a)
@@ -384,7 +385,13 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
         {
           a->ref_count++;
           *r_app = a;
-        }
+          if (a_prev)
+            {
+              a_prev->next = a->next;
+              a->next = app_top;
+              app_top = a;
+            }
+      }
       unlock_app (a);
     }
   else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list