direwolf: fix build w/ glibc-2.38

Failing Hydra build: https://hydra.nixos.org/build/230546596

+91
+2
pkgs/applications/radio/direwolf/default.nix
··· 14 14 sha256 = "0xmz64m02knbrpasfij4rrq53ksxna5idxwgabcw4n2b1ig7pyx5"; 15 15 }; 16 16 17 + patches = [ ./fix-strlcpy-usage.patch ]; 18 + 17 19 nativeBuildInputs = [ cmake ]; 18 20 19 21 strictDeps = true;
+89
pkgs/applications/radio/direwolf/fix-strlcpy-usage.patch
··· 1 + strlcpy is now part of glibc, so there's absolutely no reason for a custom implementation, especially 2 + one with printf debugging. Hence, removing all of that. 3 + 4 + See also https://hydra.nixos.org/build/230546596 5 + See glibc commit 454a20c8756c9c1d55419153255fc7692b3d2199 6 + 7 + diff --git a/external/misc/strlcpy.c b/external/misc/strlcpy.c 8 + index ff18800..b1cb443 100644 9 + --- a/external/misc/strlcpy.c 10 + +++ b/external/misc/strlcpy.c 11 + @@ -56,65 +56,3 @@ 12 + 13 + #include "textcolor.h" 14 + 15 + -/* 16 + - * Copy src to string dst of size siz. At most siz-1 characters 17 + - * will be copied. Always NUL terminates (unless siz == 0). 18 + - * Returns strlen(src); if retval >= siz, truncation occurred. 19 + - */ 20 + - 21 + -#if DEBUG_STRL 22 + -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz, const char *file, const char *func, int line) 23 + -#else 24 + -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz) 25 + -#endif 26 + -{ 27 + - char *d = dst; 28 + - const char *s = src; 29 + - size_t n = siz; 30 + - size_t retval; 31 + - 32 + -#if DEBUG_STRL 33 + - if (dst == NULL) { 34 + - text_color_set (DW_COLOR_ERROR); 35 + - dw_printf ("ERROR: strlcpy dst is NULL. (%s %s %d)\n", file, func, line); 36 + - return (0); 37 + - } 38 + - if (src == NULL) { 39 + - text_color_set (DW_COLOR_ERROR); 40 + - dw_printf ("ERROR: strlcpy src is NULL. (%s %s %d)\n", file, func, line); 41 + - return (0); 42 + - } 43 + - if (siz == 1 || siz == 4) { 44 + - text_color_set (DW_COLOR_ERROR); 45 + - dw_printf ("Suspicious strlcpy siz. Is it using sizeof a pointer variable? (%s %s %d)\n", file, func, line); 46 + - } 47 + -#endif 48 + - 49 + - /* Copy as many bytes as will fit */ 50 + - if (n != 0 && --n != 0) { 51 + - do { 52 + - if ((*d++ = *s++) == 0) 53 + - break; 54 + - } while (--n != 0); 55 + - } 56 + - 57 + - /* Not enough room in dst, add NUL and traverse rest of src */ 58 + - if (n == 0) { 59 + - if (siz != 0) 60 + - *d = '\0'; /* NUL-terminate dst */ 61 + - while (*s++) 62 + - ; 63 + - } 64 + - 65 + - retval = s - src - 1; /* count does not include NUL */ 66 + - 67 + -#if DEBUG_STRL 68 + - if (retval >= siz) { 69 + - text_color_set (DW_COLOR_ERROR); 70 + - dw_printf ("WARNING: strlcpy result length %d exceeds maximum length %d. (%s %s %d)\n", 71 + - (int)retval, (int)(siz-1), file, func, line); 72 + - } 73 + -#endif 74 + - return (retval); 75 + -} 76 + - 77 + diff --git a/src/direwolf.h b/src/direwolf.h 78 + index efc329b..22eb748 100644 79 + --- a/src/direwolf.h 80 + +++ b/src/direwolf.h 81 + @@ -294,7 +294,7 @@ char *strcasestr(const char *S, const char *FIND); 82 + #define HAVE_STRLCPY 1 83 + 84 + 85 + -#define DEBUG_STRL 1 86 + +#define DEBUG_STRL 0 87 + 88 + #if DEBUG_STRL 89 +