mac80211: use KERNEL_MAKEOPTS
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 011-backport_strscpy.patch
1 --- a/backport-include/linux/string.h
2 +++ b/backport-include/linux/string.h
3 @@ -25,4 +25,8 @@ extern void *memdup_user_nul(const void
4 void memzero_explicit(void *s, size_t count);
5 #endif
6
7 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0))
8 +ssize_t strscpy(char *dest, const char *src, size_t count);
9 +#endif
10 +
11 #endif /* __BACKPORT_LINUX_STRING_H */
12 --- a/compat/backport-4.3.c
13 +++ b/compat/backport-4.3.c
14 @@ -57,3 +57,29 @@ void seq_hex_dump(struct seq_file *m, co
15 }
16 }
17 EXPORT_SYMBOL_GPL(seq_hex_dump);
18 +
19 +ssize_t strscpy(char *dest, const char *src, size_t count)
20 +{
21 + long res = 0;
22 +
23 + if (count == 0)
24 + return -E2BIG;
25 +
26 + while (count) {
27 + char c;
28 +
29 + c = src[res];
30 + dest[res] = c;
31 + if (!c)
32 + return res;
33 + res++;
34 + count--;
35 + }
36 +
37 + /* Hit buffer length without finding a NUL; force NUL-termination. */
38 + if (res)
39 + dest[res-1] = '\0';
40 +
41 + return -E2BIG;
42 +}
43 +EXPORT_SYMBOL_GPL(strscpy);