[Pkg-gnupg-commit] [gnupg2] 16/205: g13: Return an error for non-existing device.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:09 UTC 2016


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

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 3087197008d2b12bf9f0d7d1f2aca500db816e7c
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Feb 2 18:18:31 2016 +0100

    g13: Return an error for non-existing device.
    
    * g13/sh-cmd.c (cmd_device): Set ERR.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g13/sh-cmd.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/g13/sh-cmd.c b/g13/sh-cmd.c
index 4ef37c1..8a3006c 100644
--- a/g13/sh-cmd.c
+++ b/g13/sh-cmd.c
@@ -161,7 +161,9 @@ static const char hlp_device[] =
   "DEVICE <name>\n"
   "\n"
   "Set the device used by further commands.\n"
-  "A device name or a PARTUUID string may be used.";
+  "A device name or a PARTUUID string may be used.\n"
+  "Access to that device (by the g13 system) is locked\n"
+  "until a new DEVICE command or end of this process\n";
 static gpg_error_t
 cmd_device (assuan_context_t ctx, char *line)
 {
@@ -185,7 +187,7 @@ cmd_device (assuan_context_t ctx, char *line)
       break;
   if (!ti)
     {
-      set_error (GPG_ERR_EACCES, "device not configured for user");
+      err = set_error (GPG_ERR_EACCES, "device not configured for user");
       goto leave;
     }
 
@@ -213,6 +215,8 @@ cmd_device (assuan_context_t ctx, char *line)
   fp = NULL;
   ctrl->devti = ti;
 
+  /* Fixme: Take some kind of lock.  */
+
  leave:
   es_fclose (fp);
   if (err)
@@ -255,7 +259,7 @@ cmd_create (assuan_context_t ctx, char *line)
   err = sh_is_empty_partition (ctrl->server_local->devicename);
   if (err)
     {
-      assuan_set_error (ctx, err, "Partition is not empty");
+      err = assuan_set_error (ctx, err, "Partition is not empty");
       goto leave;
     }
 

-- 
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