Package: irssi-plugin-xmpp / 0.53-1~bpo8+1

singpolyma-0108-Much-better-variable-names.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From bd703455cd012eeb250fd8eb9d8ef2bde23c3569 Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Wed, 18 Mar 2015 11:52:24 -0500
Subject: [PATCH 08/10] Much better variable names

---
 src/core/tools.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/core/tools.c b/src/core/tools.c
index a8019b3..fdab05f 100644
--- a/src/core/tools.c
+++ b/src/core/tools.c
@@ -37,7 +37,7 @@ static const char *utf8_charset = "UTF-8";
 
 char *call_gpg_round(char *switches, char *input, char *input2, \
                int get_stderr, int snip_data, unsigned round) {
-	int pipefd[2], pipefd2[2], rwepipe[3], childpid, in_data = !snip_data;
+	int pass_pipe[2], input2_pipe[2], rwepipe[3], childpid, in_data = !snip_data;
 	FILE* cstream;
 	char *cmd, *output = NULL;
 	size_t output_size = 0;
@@ -47,18 +47,18 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 
 	/* If no keyID, then we don't need a password */
 	if(send_password) {
-		if(pipe(pipefd)) goto pgp_error;
+		if(pipe(pass_pipe)) goto pgp_error;
 		if(!pgp_passwd) pgp_passwd = get_password("OpenPGP Password:");
 		if(!pgp_passwd) goto pgp_error;
 
-		if(write(pipefd[1], pgp_passwd, strlen(pgp_passwd)) < 0) goto pgp_error;
-		if(close(pipefd[1])) goto pgp_error;
+		if(write(pass_pipe[1], pgp_passwd, strlen(pgp_passwd)) < 0) goto pgp_error;
+		if(close(pass_pipe[1])) goto pgp_error;
 	}
 
 	if(input2) {
-		if(pipe(pipefd2)) goto pgp_error;
-		if(write(pipefd2[1], input2, strlen(input2)) < 0) goto pgp_error;
-		if(close(pipefd2[1])) goto pgp_error;
+		if(pipe(input2_pipe)) goto pgp_error;
+		if(write(input2_pipe[1], input2, strlen(input2)) < 0) goto pgp_error;
+		if(close(input2_pipe[1])) goto pgp_error;
 	}
 
 	cmd = malloc(sizeof("gpg --enable-special-filenames -u ''" \
@@ -72,8 +72,8 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 		strcpy(cmd, "gpg -u '");
 		strcat(cmd, keyid);
 		strcat(cmd, "' ");
-		if(!settings_get_str("xmpp_pgp_agent")) {
-			sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pipefd[0]);
+		if(send_password) {
+			sprintf(cmd+strlen(cmd), "--passphrase-fd '%d' ", pass_pipe[0]);
 		}
 	} else {
 		strcpy(cmd, "gpg ");
@@ -83,7 +83,7 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 	            " --batch --no-tty - ");
 
 	if(input2) {
-		sprintf(cmd+strlen(cmd), "-&%d", pipefd2[0]);
+		sprintf(cmd+strlen(cmd), "-&%d", input2_pipe[0]);
 	}
 
 	fflush(NULL);
@@ -137,8 +137,8 @@ char *call_gpg_round(char *switches, char *input, char *input2, \
 	}
 
 done:
-	if(send_password)  close(pipefd[0]);
-	if(input2)         close(pipefd2[0]);
+	if(send_password)  close(pass_pipe[0]);
+	if(input2)         close(input2_pipe[0]);
 	free(cmd);
 
 	return output;
-- 
2.1.4