File: 0001-translate-lookup-firmware-files-under-lib-firmware-u.patch

package info (click to toggle)
tqftpserv 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: ansic: 989; makefile: 3
file content (49 lines) | stat: -rw-r--r-- 1,388 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Arnaud Ferraris <aferraris@debian.org>
Date: Thu, 9 Feb 2023 19:51:15 +0100
Subject: translate: lookup firmware files under /lib/firmware/updates

`/lib/firmware/updates` is a legitimate location for firmware files,
`tqftpserv` should look there as well.
---
 translate.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/translate.c b/translate.c
index 84a36c2..de3baba 100644
--- a/translate.c
+++ b/translate.c
@@ -24,6 +24,7 @@
 #ifndef ANDROID
 #define FIRMWARE_BASE	"/lib/firmware/"
 #define TQFTPSERV_TMP	"/tmp/tqftpserv"
+#define UPDATES_DIR	"updates/"
 #else
 #define FIRMWARE_BASE	"/vendor/firmware/"
 #define TQFTPSERV_TMP	"/data/vendor/tmp/tqftpserv"
@@ -129,17 +130,25 @@ static int translate_readonly(const char *file)
 		}
 
 		/* now try with base path */
-		if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 +
+		if (strlen(FIRMWARE_BASE) + strlen(UPDATES_DIR) + strlen(firmware_value) + 1 +
 		    strlen(file) + 1 > sizeof(path))
 			continue;
 
 		strcpy(path, FIRMWARE_BASE);
+		strcat(path, UPDATES_DIR);
 		strcat(path, firmware_path);
 		strcat(path, "/");
 		strcat(path, file);
 
 		fd = open_maybe_compressed(path);
+		if (fd < 0) {
+			strcpy(path, FIRMWARE_BASE);
+			strcat(path, firmware_path);
+			strcat(path, "/");
+			strcat(path, file);
 
+			fd = open_maybe_compressed(path);
+		}
 		if (fd >= 0)
 			break;