Set pinentry->result

pull/4/head
Moritz Luedecke 7 years ago
parent e782992eae
commit e583cf17b1

@ -583,7 +583,7 @@ catchsig(int sig) {
} }
} }
static int static void
password(void) { password(void) {
winmode = WinPin; winmode = WinPin;
@ -600,27 +600,26 @@ password(void) {
return 0; return 0;
} }
pinentry->repeat_okay = 1; if (pinentry->canceled) {
pinentry->result = -1;
return;
} }
return (pinentry->canceled) ? -1 : 1; pinentry->result = strlen(pinentry->pin);
} }
static int static void
confirm(void) { confirm(void) {
winmode = WinConfirm; winmode = WinConfirm;
sel = Nothing; sel = Nothing;
run(); run();
pinentry->result = sel != No;
return sel != No;
} }
static int static int
cmdhandler(pinentry_t received_pinentry) { cmdhandler(pinentry_t received_pinentry) {
struct sigaction sa; struct sigaction sa;
XWindowAttributes wa; XWindowAttributes wa;
int ret;
pinentry = received_pinentry; pinentry = received_pinentry;
@ -655,14 +654,14 @@ cmdhandler(pinentry_t received_pinentry) {
setup(); setup();
if (pinentry->pin) { if (pinentry->pin) {
ret = password(); password();
} else { } else {
ret = confirm(); confirm();
} }
cleanup(); cleanup();
return ret; return pinentry->result;
} }
pinentry_cmd_handler_t pinentry_cmd_handler = cmdhandler; pinentry_cmd_handler_t pinentry_cmd_handler = cmdhandler;

Loading…
Cancel
Save