Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 72c55e3da59eccdfea3778d11f83862b58af723d Mon Sep 17 00:00:00 2001 |
| 2 | From: Pierre-Jean Texier <pjtexier@koncepto.io> |
| 3 | Date: Thu, 23 Jan 2020 22:42:40 +0100 |
| 4 | Subject: [PATCH 2/2] unzck: fix build with musl libc |
| 5 | |
| 6 | On musl libc "stdout" is a preprocessor macro whose expansion leads to |
| 7 | compilation errors. |
| 8 | |
| 9 | Fixes: |
| 10 | |
| 11 | | In file included from ../git/src/unzck.c:31: |
| 12 | | ../git/src/unzck.c: In function 'parse_opt': |
| 13 | | ../git/src/unzck.c:78:24: error: expected identifier before '(' token |
| 14 | | 78 | arguments->stdout = true; |
| 15 | | | ^~~~~~ |
| 16 | | ../git/src/unzck.c: In function 'main': |
| 17 | | ../git/src/unzck.c:141:20: error: expected identifier before '(' token |
| 18 | | 141 | if(!(arguments.stdout)) { |
| 19 | | | ^~~~~~ |
| 20 | |
| 21 | Upstream-Status: Submitted [https://github.com/zchunk/zchunk/pull/23] |
| 22 | |
| 23 | Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io> |
| 24 | --- |
| 25 | src/unzck.c | 6 +++--- |
| 26 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 27 | |
| 28 | diff --git a/src/unzck.c b/src/unzck.c |
| 29 | index 8d6c62a..002492c 100644 |
| 30 | --- a/src/unzck.c |
| 31 | +++ b/src/unzck.c |
| 32 | @@ -58,7 +58,7 @@ struct arguments { |
| 33 | char *args[1]; |
| 34 | zck_log_type log_level; |
| 35 | bool dict; |
| 36 | - bool stdout; |
| 37 | + bool stdOut; |
| 38 | bool exit; |
| 39 | }; |
| 40 | |
| 41 | @@ -75,7 +75,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) { |
| 42 | arguments->log_level = ZCK_LOG_DDEBUG; |
| 43 | break; |
| 44 | case 'c': |
| 45 | - arguments->stdout = true; |
| 46 | + arguments->stdOut = true; |
| 47 | break; |
| 48 | case 'V': |
| 49 | version(); |
| 50 | @@ -138,7 +138,7 @@ int main (int argc, char *argv[]) { |
| 51 | snprintf(out_name + strlen(base_name) - 4, 7, ".zdict"); |
| 52 | |
| 53 | int dst_fd = STDOUT_FILENO; |
| 54 | - if(!arguments.stdout) { |
| 55 | + if(!arguments.stdOut) { |
| 56 | dst_fd = open(out_name, O_TRUNC | O_WRONLY | O_CREAT, 0666); |
| 57 | if(dst_fd < 0) { |
| 58 | dprintf(STDERR_FILENO, "Unable to open %s", out_name); |
| 59 | -- |
| 60 | 2.7.4 |
| 61 | |