[v1,1/2] ir-ctl: use strndup instead of strndupa (fixes musl compile)
Commit Message
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(-)
@@ -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);