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.
tags/fmail-0.1.1^2
Damien Goutte-Gattat 2 years ago
parent
commit
779e629f1e
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/fmail.c

+ 4
- 1
src/fmail.c View File

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