diff options
author | Guillem Jover <guillem@hadrons.org> | 2019-07-20 21:20:58 +0200 |
---|---|---|
committer | Jeff Moyer <jmoyer@redhat.com> | 2019-07-29 12:26:10 -0400 |
commit | b9e17f6afdc4d0e81b1598aecea7b80d0c54b13a (patch) | |
tree | 37e8a65f284e1562e35c92a18f53cbbc2775dd13 | |
parent | e2175569737a2905d3c7a6e6ff664f0febcf5a28 (diff) | |
download | libaio-b9e17f6afdc4d0e81b1598aecea7b80d0c54b13a.tar.gz |
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 <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
-rw-r--r-- | harness/cases/19.t | 2 | ||||
-rw-r--r-- | harness/cases/21.t | 2 |
2 files changed, 2 insertions, 2 deletions
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"); |