Browse Source

Catch GpgME error when signing.

Listen to GpgME if an error occured when attempting to sign, and
abort if that is the case.
develop
Damien Goutte-Gattat 3 years ago
parent
commit
779e629f1e
  1. 5
      src/fmail.c

5
src/fmail.c

@ -349,13 +349,16 @@ sign_stream(gpgme_ctx_t ctx, FILE *in, FILE *out)
{
gpgme_data_t gin, gout;
gpgme_sign_result_t result;
gpgme_error_t gerr;
char boundary[32], buffer[512];
int n;
gpgme_data_new_from_stream(&gin, in);
gpgme_data_new(&gout);
gpgme_op_sign(ctx, gin, gout, GPGME_SIG_MODE_DETACH);
gerr = gpgme_op_sign(ctx, gin, gout, GPGME_SIG_MODE_DETACH);
if ( gerr != GPG_ERR_NO_ERROR )
errx(EXIT_FAILURE, "signing failed: %s", gpgme_strerror(gerr));
result = gpgme_op_sign_result(ctx);
generate_boundary(boundary, sizeof(boundary));

Loading…
Cancel
Save