From cf265cc46a68af416430cd768a17d190b5773448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Thu, 8 Nov 2018 15:58:34 +0100 Subject: [PATCH] qethqoat: Fix -Wrestrict warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of the following GCC8 compile warning by using different buffers for input/output: qethqoat.c: In function ‘ebctoasc’: qethqoat.c:51:30: warning: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Wrestrict] iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len); ^~~~~~ ~~~~~~ qethqoat.c:51:38: warning: passing argument 3 to restrict-qualified parameter aliases with argument 5 [-Wrestrict] iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len); ^~~~ ~~~~ Signed-off-by: Jan Höppner --- qethqoat/qethqoat.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/qethqoat/qethqoat.c b/qethqoat/qethqoat.c index 96dd4d36..dd8af209 100644 --- a/qethqoat/qethqoat.c +++ b/qethqoat/qethqoat.c @@ -47,9 +47,15 @@ static int mac_is_zero(__u8 *mac) return !(mac[0] | mac[1] | mac[2] | mac[3] | mac[4] | mac[5]); } -static void ebctoasc(char *inout, size_t len) +static void ebctoasc(char *in, char *out, size_t size) { - iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len); + size_t size_out = size; + size_t size_in = size; + size_t rc; + + rc = iconv(l_iconv_ebcdic_ascii, &in, &size_in, &out, &size_out); + if (rc == (size_t) -1) + fprintf(stderr, "Code page translation EBCDIC-ASCII failed\n"); } static void print_version() @@ -288,6 +294,7 @@ static void print_logical(struct qeth_qoat_logical *lhdr) char prouter[] = "primary"; char srouter[] = "secondary"; char nrouter[] = "no"; + char port_name[8]; char *router; if (lhdr->ip4_primary_router) @@ -341,8 +348,8 @@ static void print_logical(struct qeth_qoat_logical *lhdr) if (lhdr->port_name_f) { - ebctoasc((char *)lhdr->port_name, 8); - printf("Port name: %.8s\n", lhdr->port_name); + ebctoasc((char *)lhdr->port_name, port_name, 8); + printf("Port name: %.8s\n", port_name); } printf("IPv4 assists enabled: 0x%08x\n", lhdr->ip4_ass_enabled);