From bafe8f5eeb83f46cf833ff2b6ab6fb3277f1a438 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 24 Apr 2018 12:31:08 +0300 Subject: [PATCH] MXS-1618 Use right type for the return value of getopt_long getopt_long returns an 'int'. If 'char' is used on a big-endian platform you'll end up with an infinite loop. --- client/maxadmin.c | 2 +- server/modules/routing/binlogrouter/maxbinlogcheck.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/maxadmin.c b/client/maxadmin.c index d7e4856cd..305ae3700 100644 --- a/client/maxadmin.c +++ b/client/maxadmin.c @@ -142,7 +142,7 @@ main(int argc, char **argv) bool use_unix_socket = false; int option_index = 0; - char c; + int c; while ((c = getopt_long(argc, argv, "h:p::P:u:S:v?ei", long_options, &option_index)) >= 0) { diff --git a/server/modules/routing/binlogrouter/maxbinlogcheck.c b/server/modules/routing/binlogrouter/maxbinlogcheck.c index 820b9aa3d..1585a4789 100644 --- a/server/modules/routing/binlogrouter/maxbinlogcheck.c +++ b/server/modules/routing/binlogrouter/maxbinlogcheck.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) char *key_file = NULL; char *aes_algo = NULL; int report_header = 0; - char c; + int c; while ((c = getopt_long(argc, argv, "dVfMHK:A:?", long_options, &option_index)) >= 0) {