diff options
Diffstat (limited to 'meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch')
-rw-r--r-- | meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch new file mode 100644 index 0000000000..cc21435dde --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From 7c558e8ef9375aea953d1e7c854b25947c967f76 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 7 Jun 2024 23:09:54 -0700 | ||
4 | Subject: [PATCH] uvcgadget: Use g_path_get_basename instead of libc basename | ||
5 | |||
6 | Musl does not implement GNU basename and have fixed a bug where the | ||
7 | prototype was leaked into string.h [1], which resullts in compile errors | ||
8 | with GCC-14 and Clang-17+ | ||
9 | |||
10 | | sys/uvcgadget/configfs.c:262:21: error: call to undeclared function 'basename' | ||
11 | ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] | ||
12 | | 262 | const char *v = basename (globbuf.gl_pathv[i]); | ||
13 | | | ^ | ||
14 | |||
15 | Use glib function instead makes it portable across musl and glibc on | ||
16 | linux | ||
17 | |||
18 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7a | ||
19 | |||
20 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/7006] | ||
21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
22 | --- | ||
23 | .../gst-plugins-bad/sys/uvcgadget/configfs.c | 18 ++++++++++++------ | ||
24 | 1 file changed, 12 insertions(+), 6 deletions(-) | ||
25 | |||
26 | --- a/sys/uvcgadget/configfs.c | ||
27 | +++ b/sys/uvcgadget/configfs.c | ||
28 | @@ -7,7 +7,7 @@ | ||
29 | * Contact: Kieran Bingham <kieran.bingham@ideasonboard.com> | ||
30 | */ | ||
31 | |||
32 | -/* To provide basename and asprintf from the GNU library. */ | ||
33 | +/* To provide asprintf from the GNU library. */ | ||
34 | #define _GNU_SOURCE | ||
35 | |||
36 | #include <dirent.h> | ||
37 | @@ -259,9 +259,10 @@ udc_find_video_device (const char *udc, | ||
38 | } | ||
39 | |||
40 | if (i < globbuf.gl_pathc) { | ||
41 | - const char *v = basename (globbuf.gl_pathv[i]); | ||
42 | + gchar *v = g_path_get_basename (globbuf.gl_pathv[i]); | ||
43 | |||
44 | video = path_join ("/dev", v); | ||
45 | + g_free (v); | ||
46 | } | ||
47 | |||
48 | globfree (&globbuf); | ||
49 | @@ -894,6 +895,7 @@ configfs_parse_uvc_function (const char | ||
50 | { | ||
51 | struct uvc_function_config *fc; | ||
52 | char *fpath; | ||
53 | + gchar *bname; | ||
54 | int ret = 0; | ||
55 | |||
56 | fc = malloc (sizeof *fc); | ||
57 | @@ -923,11 +925,10 @@ configfs_parse_uvc_function (const char | ||
58 | * Parse the function configuration. Remove the gadget name qualifier | ||
59 | * from the function name, if any. | ||
60 | */ | ||
61 | - if (function) | ||
62 | - function = basename (function); | ||
63 | + bname = g_path_get_basename (function); | ||
64 | |||
65 | fc->udc = attribute_read_str (fpath, "../../UDC"); | ||
66 | - fc->video = udc_find_video_device (fc->udc, function); | ||
67 | + fc->video = udc_find_video_device (fc->udc, bname); | ||
68 | if (!fc->video) { | ||
69 | ret = -ENODEV; | ||
70 | goto done; | ||
71 | @@ -942,6 +943,7 @@ done: | ||
72 | } | ||
73 | |||
74 | free (fpath); | ||
75 | + g_free (bname); | ||
76 | |||
77 | return fc; | ||
78 | } | ||
79 | @@ -979,12 +981,16 @@ configfs_parse_uvc_videodev (int fd, con | ||
80 | char *function = NULL; | ||
81 | char rpath[PATH_MAX]; | ||
82 | char *res; | ||
83 | + gchar *bname; | ||
84 | |||
85 | res = realpath (video, rpath); | ||
86 | if (!res) | ||
87 | return NULL; | ||
88 | |||
89 | - function = video_find_config_name (basename (rpath)); | ||
90 | + bname = g_path_get_basename (rpath); | ||
91 | + function = video_find_config_name (bname); | ||
92 | + g_free (bname); | ||
93 | + | ||
94 | if (!function) | ||
95 | return NULL; | ||
96 | |||