iotools: Fix werror and refactor definition

This commit is contained in:
Petr Hodina
2025-04-26 10:59:58 +02:00
parent ed2bf86fb4
commit 09d8b2e359
2 changed files with 20 additions and 5 deletions
@@ -0,0 +1,13 @@
diff --git a/commands.c b/commands.c
index a83f1d5..b3f217a 100644
--- a/commands.c
+++ b/commands.c
@@ -152,1 +152,7 @@ build_symlink_name(const char *path_to_bin, const struct cmd_info *cmd)
- snprintf(link_name, FILENAME_MAX, "%s/%s", path_to_bin, cmd->name);
+ int result = snprintf(link_name, FILENAME_MAX, "%s/%s", path_to_bin, cmd->name);
+
+ if (result >= FILENAME_MAX) {
+ link_name[FILENAME_MAX - 1] = '\0';
+ } else if (result < 0) {
+ link_name[0] = '\0';
+ }
+7 -5
View File
@@ -4,7 +4,7 @@
fetchFromGitHub,
}:
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "iotools";
version = "unstable-2017-12-11";
@@ -15,6 +15,8 @@ stdenv.mkDerivation {
hash = "sha256-tlGXJn3n27mQDupMIVYDd86YaWazVwel/qs0QqCy1W8=";
};
patches = [ ./001-fix-werror-in-sprintf.patch ];
makeFlags = [
"DEBUG=0"
"STATIC=0"
@@ -24,7 +26,7 @@ stdenv.mkDerivation {
install -Dm755 iotools -t $out/bin
'';
meta = with lib; {
meta = {
description = "Set of simple command line tools which allow access to
hardware device registers";
longDescription = ''
@@ -35,12 +37,12 @@ stdenv.mkDerivation {
operations.
'';
homepage = "https://github.com/adurbin/iotools";
license = licenses.gpl2Only;
maintainers = with maintainers; [ felixsinger ];
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ felixsinger ];
platforms = [
"x86_64-linux"
"i686-linux"
];
mainProgram = "iotools";
};
}
})