buf[0] = c;
gpgme_data_write (data, buf, 1);
}
- fclose(fptmp);
+ safe_fclose (&fptmp);
gpgme_data_seek (data, 0, SEEK_SET);
}
else
{
- fclose(fptmp);
+ safe_fclose (&fptmp);
err = gpgme_data_new_from_file (&data, tempfile, 1);
}
unlink (tempfile);
if (fwrite (buf, nread, 1, fp) != 1)
{
mutt_perror (tempfile);
- fclose (fp);
+ safe_fclose (&fp);
unlink (tempfile);
return NULL;
}
if (ret_fp)
rewind (fp);
else
- fclose (fp);
+ safe_fclose (&fp);
if (nread == -1)
{
mutt_error (_("error reading data object: %s\n"), gpgme_strerror (err));
unlink (tempfile);
- fclose (fp);
+ safe_fclose (&fp);
return NULL;
}
if (ret_fp)
b->type = saved_b_type;
b->length = saved_b_length;
b->offset = saved_b_offset;
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
rewind (*fpout);
if (*cur && !is_signed && !(*cur)->parts && mutt_is_application_smime (*cur))
{
bb->length = ftello (s.fpout);
bb->offset = 0;
rewind (tmpfp);
- fclose (*fpout);
+ safe_fclose (fpout);
memset (&s, 0, sizeof (s));
s.fpin = tmpfp;
bb->type = saved_b_type;
bb->length = saved_b_length;
bb->offset = saved_b_offset;
- fclose (tmpfp);
+ safe_fclose (&tmpfp);
rewind (*fpout);
mutt_free_body (cur);
*cur = tmp_b;
err_fp:
if (rc)
- {
- fclose (*fp);
- *fp = NULL;
- }
+ safe_fclose (fp);
err_tmpdir:
if (dryrun)
mutt_rmtree (tmpdir);
dprint (1, (debugfile, "error converting key file into data object\n"));
return;
}
- fclose (in);
+ safe_fclose (&in);
if (!pgp_gpgme_extract_keys (keydata, &out, 0))
{
outlen = ftell (out);
fseek (out, 0, SEEK_SET);
mutt_copy_bytes (out, stdout, outlen);
- fclose (out);
+ safe_fclose (&out);
}
else
printf (_("Error extracting key data!\n"));
}
fgetconv_close (&fc);
- fclose (fp);
+ safe_fclose (&fp);
}
mutt_free_body (&tattach);
}
- fclose (fpout);
+ safe_fclose (&fpout);
mutt_unlink(tempfile);
dprint (2, (debugfile, "Leaving pgp_encrypted handler\n"));
mutt_free_body (&tattach);
}
- fclose (fpout);
+ safe_fclose (&fpout);
mutt_unlink(tempfile);
dprint (2, (debugfile, "Leaving smime_encrypted handler\n"));
leave:
gpgme_key_release (k);
gpgme_release (listctx);
- fclose (fp);
+ safe_fclose (&fp);
mutt_clear_error ();
snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"), crypt_keyid (key));
mutt_do_pager (cmd, tempfile, 0, NULL);
default: abort ();
}
- *last = rfc822_cpy_adr (p);
+ *last = rfc822_cpy_adr (p, 0);
while (*last)
last = &((*last)->next);
}