Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong
GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/packages/extras-buildpkgs/libvdpau/debian/patches/simplify-dlopen-path-length-error-handling.patch
13915 views
1
From: Andreas Beckmann <[email protected]>
2
Subject: simplify path overflow error handling
3
"path too long" is not a fatal error, there may be other search paths
4
that don't overflow, so try them as well
5
6
--- a/src/vdpau_wrapper.c
7
+++ b/src/vdpau_wrapper.c
8
@@ -132,6 +132,8 @@ static VdpStatus _vdp_open_driver(
9
vdpau_driver = "nvidia";
10
}
11
12
+ _vdp_driver_dll = NULL;
13
+
14
/* Don't allow setuid apps to use VDPAU_DRIVER_PATH */
15
vdpau_driver_path = secure_getenv("VDPAU_DRIVER_PATH");
16
if (vdpau_driver_path &&
17
@@ -141,12 +143,6 @@ static VdpStatus _vdp_open_driver(
18
DRIVER_LIB_FORMAT, VDPAU_MODULEDIR, vdpau_driver) >=
19
sizeof(vdpau_driver_lib)) {
20
fprintf(stderr, "Failed to construct driver path: path too long\n");
21
- if (vdpau_driver_dri2) {
22
- XFree(vdpau_driver_dri2);
23
- vdpau_driver_dri2 = NULL;
24
- }
25
- _VDP_ERROR_BREAKPOINT();
26
- return VDP_STATUS_NO_IMPLEMENTATION;
27
}
28
else {
29
_vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
30
@@ -154,11 +150,12 @@ static VdpStatus _vdp_open_driver(
31
}
32
33
if (!_vdp_driver_dll) {
34
- /* Try again using the old path, which is guaranteed to fit in PATH_MAX
35
- * if the complete path fit above. */
36
- snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib),
37
- DRIVER_FALLBACK_LIB_FORMAT, vdpau_driver);
38
- _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
39
+ /* Try again using the old path. */
40
+ if (snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib),
41
+ DRIVER_FALLBACK_LIB_FORMAT, vdpau_driver) <
42
+ sizeof(vdpau_driver_lib)) {
43
+ _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL);
44
+ }
45
}
46
47
if (vdpau_driver_dri2) {
48
49