char pk7out[_POSIX_PATH_MAX], certfile[_POSIX_PATH_MAX];
char tmpfname[_POSIX_PATH_MAX];
pid_t thepid;
+ int empty;
fperr = m_tempfile (tmpfname, sizeof(tmpfname), NONULL(Tempdir), NULL);
if (!fperr) {
return NULL;
}
- fclose (fpout);
-
/* Extract signer's certificate
*/
if ((thepid = smime_invoke (NULL, NULL, NULL,
mutt_any_key_to_continue (_
("Error: unable to create OpenSSL subprocess!"));
fclose (fperr);
+ fclose (fpout);
mutt_unlink (pk7out);
mutt_unlink (certfile);
return NULL;
mutt_wait_filter (thepid);
+ fflush (fpout);
+ rewind (fpout);
rewind (fperr);
fflush (fperr);
+ empty = (fgetc (fpout) == EOF);
+ if (empty) {
+ mutt_endwin (NULL);
+ mutt_copy_stream (fperr, stdout);
+ mutt_any_key_to_continue (NULL);
+ fclose (fpout);
+ fclose (fperr);
+ mutt_unlink (certfile);
+ return NULL;
+ }
- mutt_endwin (NULL);
- mutt_copy_stream (fperr, stdout);
+ fclose (fpout);
fclose (fperr);
- mutt_any_key_to_continue (NULL);
- mutt_unlink (certfile);
- return NULL;
+
+ return m_strdup(certfile);
}
/* Add a certificate and update index file (externally). */