mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
tools: Add a way to cancell INQUIRE for gpg-connect-agent.
* tools/gpg-connect-agent.c (handle_inquire): When the helper program exit status is not 0, it means cancellation, now. -- GnuPG-bug-id: 6010 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
24d02b8a32
commit
5a327e8001
@ -1978,6 +1978,7 @@ handle_inquire (assuan_context_t ctx, char *line)
|
|||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int rc, n;
|
int rc, n;
|
||||||
|
int cancelled = 0;
|
||||||
|
|
||||||
/* Skip the command and trailing spaces. */
|
/* Skip the command and trailing spaces. */
|
||||||
for (; *line && !spacep (line); line++)
|
for (; *line && !spacep (line); line++)
|
||||||
@ -2059,21 +2060,22 @@ handle_inquire (assuan_context_t ctx, char *line)
|
|||||||
log_error ("error reading from '%s': %s\n", d->file, strerror (errno));
|
log_error ("error reading from '%s': %s\n", d->file, strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = assuan_send_data (ctx, NULL, 0);
|
|
||||||
if (rc)
|
|
||||||
log_error ("sending data back failed: %s\n", gpg_strerror (rc) );
|
|
||||||
|
|
||||||
if (d->is_var)
|
if (d->is_var)
|
||||||
;
|
;
|
||||||
else if (d->is_prog)
|
else if (d->is_prog)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_W32CE_SYSTEM
|
#ifndef HAVE_W32CE_SYSTEM
|
||||||
if (pclose (fp))
|
if (pclose (fp))
|
||||||
log_error ("error running '%s': %s\n", d->file, strerror (errno));
|
cancelled = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
|
rc = assuan_send_data (ctx, NULL, cancelled);
|
||||||
|
if (rc)
|
||||||
|
log_error ("sending data back failed: %s\n", gpg_strerror (rc) );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user