From: Guillem Jover Date: Sat, 20 Jul 2019 19:20:58 +0000 (+0200) Subject: [PATCH libaio 17/28] harness: Use destination strncpy() expression for sizeof() argument X-Git-Tag: archive/raspbian/0.3.112-13+rpi1~1^2~28 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2f49e08d927a238629632b81403edbf1e91c6ea6;p=libaio.git [PATCH libaio 17/28] harness: Use destination strncpy() expression for sizeof() argument Even though this is the same size, as the sizeof() is derived from the source expression, recent gcc versions will emit a warning, which is turned into an error by -Werror: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess] Signed-off-by: Guillem Jover Signed-off-by: Jeff Moyer Gbp-Pq: Topic upstream Gbp-Pq: Name 0017-harness-Use-destination-strncpy-expression-for-sizeo.patch --- diff --git a/harness/cases/19.t b/harness/cases/19.t index 4989510..5c3e0d6 100644 --- a/harness/cases/19.t +++ b/harness/cases/19.t @@ -41,7 +41,7 @@ open_temp_file(void) int fd; char template[sizeof(TEMPLATE)]; - strncpy(template, TEMPLATE, sizeof(TEMPLATE)); + strncpy(template, TEMPLATE, sizeof(template)); fd = mkostemp(template, O_DIRECT); if (fd < 0) { perror("mkstemp"); diff --git a/harness/cases/21.t b/harness/cases/21.t index 441eaa8..fe33a9d 100644 --- a/harness/cases/21.t +++ b/harness/cases/21.t @@ -43,7 +43,7 @@ open_temp_file() int fd; char temp_file[sizeof(TEMPLATE)]; - strncpy(temp_file, TEMPLATE, sizeof(TEMPLATE)); + strncpy(temp_file, TEMPLATE, sizeof(temp_file)); fd = mkstemp(temp_file); if (fd < 0) { perror("mkstemp");