aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Märdian <slyon@ubuntu.com>2021-03-04 13:24:10 +0100
committerSimon Ser <contact@emersion.fr>2021-03-08 12:03:48 +0100
commit7dffe9339bf8a92a556098d86712c4c38ac95226 (patch)
tree274a1adcc407290c01ad11e9eb9dd5e9c5370928
parentd8a422575bcb4bedd533e068aed6876a7291d8ca (diff)
xcursor: use strncat instead of strncpy
strncat appends '\0' automatically and avoids the stringop-truncation warning/error
-rw-r--r--xcursor/xcursor.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c
index d33dee28..acb2e1a8 100644
--- a/xcursor/xcursor.c
+++ b/xcursor/xcursor.c
@@ -655,11 +655,7 @@ _XcursorAddPathElt (char *path, const char *elt, int len)
elt++;
len--;
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
- strncpy (path + pathlen, elt, len);
- path[pathlen + len] = '\0';
-#pragma GCC diagnostic pop
+ strncat (path + pathlen, elt, len);
}
static char *