| 1 |
From bd703455cd012eeb250fd8eb9d8ef2bde23c3569 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Stephen Paul Weber <[email protected]> |
| 3 |
Date: Wed, 18 Mar 2015 11:52:24 -0500 |
| 4 |
Subject: [PATCH 08/10] Much better variable names |
| 5 |
|
| 6 |
--- |
| 7 |
src/core/tools.c | 24 ++++++++++++------------ |
| 8 |
1 file changed, 12 insertions(+), 12 deletions(-) |
| 9 |
|
| 10 |
diff --git a/src/core/tools.c b/src/core/tools.c |
| 11 |
index a8019b3..fdab05f 100644 |
| 12 |
--- a/src/core/tools.c |
| 13 |
+++ b/src/core/tools.c |
| 14 |
@@ -37,7 +37,7 @@ static const char *utf8_charset = "UTF-8"; |
| 15 |
|
| 16 |
char *call_gpg_round(char *switches, char *input, char *input2, \ |
| 17 |
int get_stderr, int snip_data, unsigned round) { |
| 18 |
- int pipefd[2], pipefd2[2], rwepipe[3], childpid, in_data = !snip_data; |
| 19 |
+ int pass_pipe[2], input2_pipe[2], rwepipe[3], childpid, in_data = !snip_data; |
| 20 |
FILE* cstream; |
| 21 |
char *cmd, *output = NULL; |
| 22 |
size_t output_size = 0; |
| 23 |
@@ -47,18 +47,18 @@ char *call_gpg_round(char *switches, char *input, char *input2, \ |
| 24 |
|
| 25 |
/* If no keyID, then we don't need a password */ |
| 26 |
if(send_password) { |
| 27 |
- if(pipe(pipefd)) goto pgp_error; |
| 28 |
+ if(pipe(pass_pipe)) goto pgp_error; |
| 29 |
if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:"); |
| 30 |
if(!pgp_passwd) goto pgp_error; |
| 31 |
|
| 32 |
- if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 0) goto pgp_error; |
| 33 |
- if(close(pipefd[1])) goto pgp_error; |
| 34 |
+ if(write(pass_pipe[1], pgp_passwd, strlen(pgp_passwd)) < 0) goto pgp_error; |
| 35 |
+ if(close(pass_pipe[1])) goto pgp_error; |
| 36 |
} |
| 37 |
|
| 38 |
if(input2) { |
| 39 |
- if(pipe(pipefd2)) goto pgp_error; |
| 40 |
- if(write(pipefd2[1], input2, strlen(input2)) < 0) goto pgp_error; |
| 41 |
- if(close(pipefd2[1])) goto pgp_error; |
| 42 |
+ if(pipe(input2_pipe)) goto pgp_error; |
| 43 |
+ if(write(input2_pipe[1], input2, strlen(input2)) < 0) goto pgp_error; |
| 44 |
+ if(close(input2_pipe[1])) goto pgp_error; |
| 45 |
} |
| 46 |
|
| 47 |
cmd = malloc(sizeof("gpg --enable-special-filenames -u ''" \ |
| 48 |
@@ -72,8 +72,8 @@ char *call_gpg_round(char *switches, char *input, char *input2, \ |
| 49 |
strcpy(cmd, "gpg -u '"); |
| 50 |
strcat(cmd, keyid); |
| 51 |
strcat(cmd, "' "); |
| 52 |
- if(!settings_get_str("xmpp_pgp_agent")) { |
| 53 |
- sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pipefd[0]); |
| 54 |
+ if(send_password) { |
| 55 |
+ sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pass_pipe[0]); |
| 56 |
} |
| 57 |
} else { |
| 58 |
strcpy(cmd, "gpg "); |
| 59 |
@@ -83,7 +83,7 @@ char *call_gpg_round(char *switches, char *input, char *input2, \ |
| 60 |
" --batch --no-tty - "); |
| 61 |
|
| 62 |
if(input2) { |
| 63 |
- sprintf(cmd+strlen(cmd), "-&%d", pipefd2[0]); |
| 64 |
+ sprintf(cmd+strlen(cmd), "-&%d", input2_pipe[0]); |
| 65 |
} |
| 66 |
|
| 67 |
fflush(NULL); |
| 68 |
@@ -137,8 +137,8 @@ char *call_gpg_round(char *switches, char *input, char *input2, \ |
| 69 |
} |
| 70 |
|
| 71 |
done: |
| 72 |
- if(send_password) close(pipefd[0]); |
| 73 |
- if(input2) close(pipefd2[0]); |
| 74 |
+ if(send_password) close(pass_pipe[0]); |
| 75 |
+ if(input2) close(input2_pipe[0]); |
| 76 |
free(cmd); |
| 77 |
|
| 78 |
return output; |
| 79 |
-- |
| 80 |
2.1.4 |
| 81 |
|