summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch')
-rw-r--r--meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch
new file mode 100644
index 000000000..0a986ae5d
--- /dev/null
+++ b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch
@@ -0,0 +1,49 @@
1From d04aa6866cbea57c4a81b033cd60586a9436ac6b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 14 Jul 2017 13:20:05 -0700
4Subject: [PATCH 3/3] v4l2-ctl: Do not use getsubopt
5
6POSIX says that behavior when subopts list is empty is undefined.
7musl libs will set value to NULL which leads to crash.
8
9Taken from AlpineLinux
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 utils/v4l2-ctl/v4l2-ctl-common.cpp | 19 ++++++++++---------
14 1 file changed, 10 insertions(+), 9 deletions(-)
15
16diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
17index 3ea6cd3..291fb3e 100644
18--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
19+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
20@@ -692,16 +692,17 @@ static bool parse_subset(char *optarg)
21
22 static bool parse_next_subopt(char **subs, char **value)
23 {
24- static char *const subopts[] = {
25- NULL
26- };
27- int opt = getsubopt(subs, subopts, value);
28+ char *p = *subs;
29+ *value = *subs;
30
31- if (opt < 0 || *value)
32- return false;
33- fprintf(stderr, "No value given to suboption <%s>\n",
34- subopts[opt]);
35- return true;
36+ while (*p && *p != ',')
37+ p++;
38+
39+ if (*p)
40+ *p++ = '\0';
41+
42+ *subs = p;
43+ return false;
44 }
45
46 void common_cmd(int ch, char *optarg)
47--
482.13.3
49