diff mbox

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

Message ID 20170220203344.17530-1-ps.report@gmx.net (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Seiderer Feb. 20, 2017, 8:33 p.m. UTC
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@gmx.net>
---
 utils/ir-ctl/ir-ctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

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);