aboutsummaryrefslogtreecommitdiffstats
path: root/community/lastpass-cli/0001-generate-fix-type-for-option-parsing.patch
blob: 6cc03a787f4411c152b9d10e52800a75f2ec5e3a (plain)
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
From d170eb7809501ef16108c27be24ba4ab5797a9c3 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 26 Oct 2017 14:49:07 +0000
Subject: [PATCH] generate: fix type for option parsing

char may or may not be signed depending on architecture. If char is
unsigned on a given architecture, then will the testing the return value
from getopt_long (which is int) always fail. This happened on some
architectures like ppc64le, aarch64 and s390x.

To fix this we use same type as getopt_long return value: int.

fixes #345

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 cmd-generate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd-generate.c b/cmd-generate.c
index ce16c25..9eff89a 100644
--- a/cmd-generate.c
+++ b/cmd-generate.c
@@ -61,7 +61,7 @@ int cmd_generate(int argc, char **argv)
 		{"clip", no_argument, NULL, 'c'},
 		{0, 0, 0, 0}
 	};
-	char option;
+	int option;
 	int option_index;
 	char *username = NULL;
 	char *url = NULL;
-- 
2.14.3