mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 08:12:27 -04:00
Notably: - libc needs to #undef some of the macros from ssp/* for underlying implementations - ssp/* wants a __RENAME() macro (snatched more or less from NetBSD) There's some extra hinkiness included for read(), since libc spells it as "_read" while the rest of the world spells it "read." Reviewed by: imp, ngie Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32307
31 lines
520 B
C
31 lines
520 B
C
/*-
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2023 Robert Clausecker
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <string.h>
|
|
|
|
#undef strncat /* _FORTIFY_SOURCE */
|
|
|
|
void *__memccpy(void *restrict, const void *restrict, int, size_t);
|
|
|
|
char *
|
|
strncat(char *dest, const char *src, size_t n)
|
|
{
|
|
size_t len;
|
|
char *endptr;
|
|
|
|
len = strlen(dest);
|
|
endptr = __memccpy(dest + len, src, '\0', n);
|
|
|
|
/* avoid an extra branch */
|
|
if (endptr == NULL)
|
|
endptr = dest + len + n + 1;
|
|
|
|
endptr[-1] = '\0';
|
|
|
|
return (dest);
|
|
}
|