From: Jozsef Kadlecsik Date: Mon, 14 Dec 2020 09:12:57 +0000 (+0100) Subject: Backward compatibility: handle missing strscpy with a wrapper of strlcpy. X-Git-Tag: v7.10~7 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8bdd23ceca429ea32d60d869175b8b49093f8eff;p=thirdparty%2Fipset.git Backward compatibility: handle missing strscpy with a wrapper of strlcpy. Signed-off-by: Jozsef Kadlecsik --- diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in index bf99bc0f..eecf3302 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in +++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in @@ -446,7 +446,12 @@ static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type) #endif #ifndef HAVE_STRSCPY -#define strscpy(dst, src, n) (strncpy(dst, src, n) == (dst)) +static inline ssize_t strscpy(char * dest, const char * src, size_t count) +{ + size_t ret = strlcpy(dest, src, count); + + return (ret >= count ? -E2BIG : ret); +} #endif #ifndef smp_mb__before_atomic