]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/libv4l/0002-ir-ctl-fixes-for-musl-compile.patch
libv4l/ir-ctl: fix musl compile
[coffee/buildroot.git] / package / libv4l / 0002-ir-ctl-fixes-for-musl-compile.patch
1 From 9908872aaa614a6c4bba80d7a5f1adea7ca7117e Mon Sep 17 00:00:00 2001
2 From: Peter Seiderer <ps.report@gmx.net>
3 Date: Tue, 14 Feb 2017 21:27:59 +0100
4 Subject: [PATCH] ir-ctl: fixes for musl compile
5
6 - add copy of TEMP_FAILURE_RETRY macro
7 - use strdup instead of strdupa
8
9 Fixes [1]:
10
11   ir-ctl.c:(.text+0xb06): undefined reference to `strndupa'
12   ir-ctl.c:(.text+0xe01): undefined reference to `TEMP_FAILURE_RETRY'
13
14 [1] http://autobuild.buildroot.net/results/b8b96c7bbf2147dacac62485cbfdbcfd758271a5
15
16 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
17 ---
18  utils/ir-ctl/ir-ctl.c | 13 ++++++++++++-
19  1 file changed, 12 insertions(+), 1 deletion(-)
20
21 diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
22 index bc58cee..e9da777 100644
23 --- a/utils/ir-ctl/ir-ctl.c
24 +++ b/utils/ir-ctl/ir-ctl.c
25 @@ -44,6 +44,15 @@
26  
27  # define N_(string) string
28  
29 +/* taken from glibc unistd.h */
30 +#ifndef TEMP_FAILURE_RETRY
31 +#define TEMP_FAILURE_RETRY(expression) \
32 +  (__extension__                                                              \
33 +    ({ long int __result;                                                     \
34 +       do __result = (long int) (expression);                                 \
35 +       while (__result == -1L && errno == EINTR);                             \
36 +       __result; }))
37 +#endif
38  
39  /* See drivers/media/rc/ir-lirc-codec.c line 23 */
40  #define LIRCBUF_SIZE   512
41 @@ -344,12 +353,14 @@ static struct file *read_scancode(const char *name)
42                 return NULL;
43         }
44  
45 -       pstr = strndupa(name, p - name);
46 +       pstr = strndup(name, p - name);
47  
48         if (!protocol_match(pstr, &proto)) {
49                 fprintf(stderr, _("error: protocol '%s' not found\n"), pstr);
50 +               free(pstr);
51                 return NULL;
52         }
53 +       free(pstr);
54  
55         if (!strtoscancode(p + 1, &scancode)) {
56                 fprintf(stderr, _("error: invalid scancode '%s'\n"), p + 1);
57 -- 
58 2.11.0
59