1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-28 21:50:02 +02:00

g13: Return an error for non-existing device.

* g13/sh-cmd.c (cmd_device): Set ERR.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-02-02 18:18:31 +01:00
parent 6390beca54
commit 3087197008
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -161,7 +161,9 @@ static const char hlp_device[] =
"DEVICE <name>\n" "DEVICE <name>\n"
"\n" "\n"
"Set the device used by further commands.\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 static gpg_error_t
cmd_device (assuan_context_t ctx, char *line) cmd_device (assuan_context_t ctx, char *line)
{ {
@ -185,7 +187,7 @@ cmd_device (assuan_context_t ctx, char *line)
break; break;
if (!ti) 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; goto leave;
} }
@ -213,6 +215,8 @@ cmd_device (assuan_context_t ctx, char *line)
fp = NULL; fp = NULL;
ctrl->devti = ti; ctrl->devti = ti;
/* Fixme: Take some kind of lock. */
leave: leave:
es_fclose (fp); es_fclose (fp);
if (err) if (err)
@ -255,7 +259,7 @@ cmd_create (assuan_context_t ctx, char *line)
err = sh_is_empty_partition (ctrl->server_local->devicename); err = sh_is_empty_partition (ctrl->server_local->devicename);
if (err) if (err)
{ {
assuan_set_error (ctx, err, "Partition is not empty"); err = assuan_set_error (ctx, err, "Partition is not empty");
goto leave; goto leave;
} }