diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-06 18:58:39 +0300 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-06 18:58:39 +0300 |
commit | d7015e92a719c9a8cf46217d2901eceeff6ffbbc (patch) | |
tree | 8bbd4ad3af16a001fc17fb0bbb45c28ef26a7e23 | |
parent | 4b3e047ec696b124db903212615ffeef2d15b2bc (diff) |
Add GCC version check for #pragma
-rw-r--r-- | src/microtar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/microtar.c b/src/microtar.c index ddd0c0c..2cb9733 100644 --- a/src/microtar.c +++ b/src/microtar.c @@ -222,7 +222,7 @@ static int header_to_raw(char* raw, const mtar_header_t* h) raw[TYPE_OFF] = h->type ? h->type : MTAR_TREG; -#ifdef __GNUC__ +#if defined(__GNUC__) && (__GNUC__ >= 8) /* Sigh. GCC wrongly assumes the output of strncpy() is supposed to be * a null-terminated string -- which it is not, and we are relying on * that fact here -- and tries to warn about 'string truncation' because @@ -234,7 +234,7 @@ static int header_to_raw(char* raw, const mtar_header_t* h) strncpy(&raw[NAME_OFF], h->name, NAME_LEN); strncpy(&raw[LINKNAME_OFF], h->linkname, LINKNAME_LEN); -#ifdef __GNUC__ +#if defined(__GNUC__) && (__GNUC__ >= 8) # pragma GCC diagnostic pop #endif |