[PATCH v1 1/2] ir-ctl: use strndup instead of strndupa (fixes musl compile)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes buildroot musl compile (see [1], [2]):

  ir-ctl.c:(.text+0xb06): undefined reference to `strndupa'

[1] http://autobuild.buildroot.net/results/b8b96c7bbf2147dacac62485cbfdbcfd758271a5
[2] http://lists.busybox.net/pipermail/buildroot/2017-February/184048.html

Signed-off-by: Peter Seiderer <ps.report@xxxxxxx>
---
 utils/ir-ctl/ir-ctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index bc58cee0..f938b429 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -344,12 +344,14 @@ static struct file *read_scancode(const char *name)
 		return NULL;
 	}
 
-	pstr = strndupa(name, p - name);
+	pstr = strndup(name, p - name);
 
 	if (!protocol_match(pstr, &proto)) {
 		fprintf(stderr, _("error: protocol '%s' not found\n"), pstr);
+		free(pstr);
 		return NULL;
 	}
+	free(pstr);
 
 	if (!strtoscancode(p + 1, &scancode)) {
 		fprintf(stderr, _("error: invalid scancode '%s'\n"), p + 1);
-- 
2.11.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux