libndctl: fix musl build

Technically this patch will leak the first argument passed to daxctl.
Since it is a short-running CLI tool it doesn't matter much.

+29
+22
pkgs/by-name/li/libndctl/musl-compat.patch
··· 1 + diff --git a/daxctl/device.c b/daxctl/device.c 2 + index e3993b1..0b2f20d 100644 3 + --- a/daxctl/device.c 4 + +++ b/daxctl/device.c 5 + @@ -23,6 +23,8 @@ 6 + #include "filter.h" 7 + #include "json.h" 8 + 9 + +#include <libgen.h> 10 + + 11 + static struct { 12 + const char *dev; 13 + const char *mode; 14 + @@ -366,7 +368,7 @@ static const char *parse_device_options(int argc, const char **argv, 15 + 16 + argc = parse_options(argc, argv, options, u, 0); 17 + if (argc > 0) 18 + - device = basename(argv[0]); 19 + + device = basename(strdup(argv[0])); 20 + 21 + /* Handle action-agnostic non-option arguments */ 22 + if (argc == 0 &&
+7
pkgs/by-name/li/libndctl/package.nix
··· 25 25 sha256 = "sha256-gG1Rz5AtDLzikGFr8A3l25ypd+VoLw2oWjszy9ogDLk="; 26 26 }; 27 27 28 + patches = lib.optionals (!stdenv.hostPlatform.isGnu) [ 29 + # Use POSIX basename on non-glib. 30 + # Remove when https://github.com/pmem/ndctl/pull/263 31 + # or equivalent fix is merged and released. 32 + ./musl-compat.patch 33 + ]; 34 + 28 35 outputs = [ 29 36 "out" 30 37 "man"