Use fprintf() for writing PGP passphrase (like we do for GPG)
- avoids having two separate write()'s to check - ...if we actually checked the result, gcc doesn't whine about unchecked fprintf() return...
This commit is contained in:
parent
f78fa31737
commit
8e1cb253db
|
@ -353,6 +353,7 @@ static int makePGPSignature(const char * file, rpmSigTag * sigTagp,
|
||||||
char * sigfile = NULL;
|
char * sigfile = NULL;
|
||||||
int pid, status;
|
int pid, status;
|
||||||
int inpipe[2];
|
int inpipe[2];
|
||||||
|
FILE *fpipe;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
const char * cmd;
|
const char * cmd;
|
||||||
char *const *av;
|
char *const *av;
|
||||||
|
@ -416,11 +417,12 @@ static int makePGPSignature(const char * file, rpmSigTag * sigTagp,
|
||||||
delMacro(NULL, "__plaintext_filename");
|
delMacro(NULL, "__plaintext_filename");
|
||||||
delMacro(NULL, "__signature_filename");
|
delMacro(NULL, "__signature_filename");
|
||||||
|
|
||||||
|
fpipe = fdopen(inpipe[1], "w");
|
||||||
(void) close(inpipe[0]);
|
(void) close(inpipe[0]);
|
||||||
if (passPhrase)
|
if (fpipe) {
|
||||||
(void) write(inpipe[1], passPhrase, strlen(passPhrase));
|
fprintf(fpipe, "%s\n", (passPhrase ? passPhrase : ""));
|
||||||
(void) write(inpipe[1], "\n", 1);
|
(void) fclose(fpipe);
|
||||||
(void) close(inpipe[1]);
|
}
|
||||||
|
|
||||||
(void)waitpid(pid, &status, 0);
|
(void)waitpid(pid, &status, 0);
|
||||||
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
|
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
|
||||||
|
|
Loading…
Reference in New Issue