Loading pkgs/applications/radio/direwolf/default.nix +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ stdenv.mkDerivation rec { hash = "sha256-Vbxc6a6CK+wrBfs15dtjfRa1LJDKKyHMrg8tqsF7EX4="; }; patches = [ ./fix-strlcpy-usage.patch ]; nativeBuildInputs = [ cmake ]; strictDeps = true; Loading pkgs/applications/radio/direwolf/fix-strlcpy-usage.patchdeleted 100644 → 0 +0 −89 Original line number Diff line number Diff line strlcpy is now part of glibc, so there's absolutely no reason for a custom implementation, especially one with printf debugging. Hence, removing all of that. See also https://hydra.nixos.org/build/230546596 See glibc commit 454a20c8756c9c1d55419153255fc7692b3d2199 diff --git a/external/misc/strlcpy.c b/external/misc/strlcpy.c index ff18800..b1cb443 100644 --- a/external/misc/strlcpy.c +++ b/external/misc/strlcpy.c @@ -56,65 +56,3 @@ #include "textcolor.h" -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ - -#if DEBUG_STRL -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz, const char *file, const char *func, int line) -#else -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz) -#endif -{ - char *d = dst; - const char *s = src; - size_t n = siz; - size_t retval; - -#if DEBUG_STRL - if (dst == NULL) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("ERROR: strlcpy dst is NULL. (%s %s %d)\n", file, func, line); - return (0); - } - if (src == NULL) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("ERROR: strlcpy src is NULL. (%s %s %d)\n", file, func, line); - return (0); - } - if (siz == 1 || siz == 4) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("Suspicious strlcpy siz. Is it using sizeof a pointer variable? (%s %s %d)\n", file, func, line); - } -#endif - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - retval = s - src - 1; /* count does not include NUL */ - -#if DEBUG_STRL - if (retval >= siz) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("WARNING: strlcpy result length %d exceeds maximum length %d. (%s %s %d)\n", - (int)retval, (int)(siz-1), file, func, line); - } -#endif - return (retval); -} - diff --git a/src/direwolf.h b/src/direwolf.h index 69b0952..6f9ec1a 100644 --- a/src/direwolf.h +++ b/src/direwolf.h @@ -328,7 +328,7 @@ char *strcasestr(const char *S, const char *FIND); #endif #endif -#define DEBUG_STRL 1 // Extra Debug version when using our own strlcpy, strlcat. +#define DEBUG_STRL 0 // Extra Debug version when using our own strlcpy, strlcat. // Should be ignored if not supplying our own. #ifndef HAVE_STRLCPY // Need to supply our own. Loading
pkgs/applications/radio/direwolf/default.nix +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ stdenv.mkDerivation rec { hash = "sha256-Vbxc6a6CK+wrBfs15dtjfRa1LJDKKyHMrg8tqsF7EX4="; }; patches = [ ./fix-strlcpy-usage.patch ]; nativeBuildInputs = [ cmake ]; strictDeps = true; Loading
pkgs/applications/radio/direwolf/fix-strlcpy-usage.patchdeleted 100644 → 0 +0 −89 Original line number Diff line number Diff line strlcpy is now part of glibc, so there's absolutely no reason for a custom implementation, especially one with printf debugging. Hence, removing all of that. See also https://hydra.nixos.org/build/230546596 See glibc commit 454a20c8756c9c1d55419153255fc7692b3d2199 diff --git a/external/misc/strlcpy.c b/external/misc/strlcpy.c index ff18800..b1cb443 100644 --- a/external/misc/strlcpy.c +++ b/external/misc/strlcpy.c @@ -56,65 +56,3 @@ #include "textcolor.h" -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ - -#if DEBUG_STRL -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz, const char *file, const char *func, int line) -#else -size_t strlcpy_debug(char *__restrict__ dst, const char *__restrict__ src, size_t siz) -#endif -{ - char *d = dst; - const char *s = src; - size_t n = siz; - size_t retval; - -#if DEBUG_STRL - if (dst == NULL) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("ERROR: strlcpy dst is NULL. (%s %s %d)\n", file, func, line); - return (0); - } - if (src == NULL) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("ERROR: strlcpy src is NULL. (%s %s %d)\n", file, func, line); - return (0); - } - if (siz == 1 || siz == 4) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("Suspicious strlcpy siz. Is it using sizeof a pointer variable? (%s %s %d)\n", file, func, line); - } -#endif - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - retval = s - src - 1; /* count does not include NUL */ - -#if DEBUG_STRL - if (retval >= siz) { - text_color_set (DW_COLOR_ERROR); - dw_printf ("WARNING: strlcpy result length %d exceeds maximum length %d. (%s %s %d)\n", - (int)retval, (int)(siz-1), file, func, line); - } -#endif - return (retval); -} - diff --git a/src/direwolf.h b/src/direwolf.h index 69b0952..6f9ec1a 100644 --- a/src/direwolf.h +++ b/src/direwolf.h @@ -328,7 +328,7 @@ char *strcasestr(const char *S, const char *FIND); #endif #endif -#define DEBUG_STRL 1 // Extra Debug version when using our own strlcpy, strlcat. +#define DEBUG_STRL 0 // Extra Debug version when using our own strlcpy, strlcat. // Should be ignored if not supplying our own. #ifndef HAVE_STRLCPY // Need to supply our own.