From 33745b1fc8cc6d41f4e708d67800d296668af2ce Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 18 Feb 2021 13:44:27 +0100 Subject: ash: placate -Werror=format-security "In function 'sprint_status48': error: format not a string literal and no format arguments" function old new delta sprint_status48 160 158 -2 Signed-off-by: Denys Vlasenko --- libbb/platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libbb/platform.c') diff --git a/libbb/platform.c b/libbb/platform.c index 329b0237e..7913353e2 100644 --- a/libbb/platform.c +++ b/libbb/platform.c @@ -166,6 +166,18 @@ char* FAST_FUNC stpcpy(char *p, const char *to_add) } #endif +#ifndef HAVE_STPNCPY +char* FAST_FUNC stpncpy(char *p, const char *to_add, size_t n) +{ + while (n != 0 && (*p = *to_add) != '\0') { + p++; + to_add++; + n--; + } + return p; +} +#endif + #ifndef HAVE_GETLINE ssize_t FAST_FUNC getline(char **lineptr, size_t *n, FILE *stream) { -- cgit v1.2.3