Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1 | From fae771aefc593a0ef798bc0c1e21b0524eb85e2d Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 31 Aug 2022 20:32:35 -0700 |
| 4 | Subject: [PATCH] Tty.xs: Do not mark strlcpy as static |
| 5 | |
| 6 | Some libcs e.g. musl do not provide implementation of strlcpy but they |
| 7 | do provide the signature in string.h, if we mark it static here then it |
| 8 | conflicts with the libc define and compiler may warn/error |
| 9 | |
| 10 | Fixes |
| 11 | Tty.xs:190:1: error: static declaration of 'strlcpy' follows non-static declaration |
| 12 | strlcpy( ^ |
| 13 | /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libio-pty-perl/1.16-r0/recipe-sysroot/usr/include/string.h:86:8: note: previous declaration is here |
| 14 | size_t strlcpy (char *, const char *, size_t); ^ |
| 15 | |
| 16 | Upstream-Status: Submitted [https://github.com/toddr/IO-Tty/pull/33] |
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 18 | --- |
| 19 | Tty.xs | 10 +++++----- |
| 20 | 1 file changed, 5 insertions(+), 5 deletions(-) |
| 21 | |
| 22 | diff --git a/Tty.xs b/Tty.xs |
| 23 | index aa638f4..4bab39d 100644 |
| 24 | --- a/Tty.xs |
| 25 | +++ b/Tty.xs |
| 26 | @@ -186,11 +186,11 @@ mysignal(int sig, mysig_t act) |
| 27 | * will be copied. Always NUL terminates (unless siz == 0). |
| 28 | * Returns strlen(src); if retval >= siz, truncation occurred. |
| 29 | */ |
| 30 | -static size_t |
| 31 | -strlcpy(dst, src, siz) |
| 32 | - char *dst; |
| 33 | - const char *src; |
| 34 | - size_t siz; |
| 35 | +size_t |
| 36 | +strlcpy( |
| 37 | + char *dst, |
| 38 | + const char *src, |
| 39 | + size_t siz) |
| 40 | { |
| 41 | register char *d = dst; |
| 42 | register const char *s = src; |
| 43 | -- |
| 44 | 2.37.3 |
| 45 | |