Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156565651
D56847.id177301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56847.id177301.diff
View Options
diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c
--- a/sbin/devmatch/devmatch.c
+++ b/sbin/devmatch/devmatch.c
@@ -102,6 +102,9 @@
size_t buflen, len;
if (linker_hints == NULL) {
+ void *all_hints = NULL;
+ size_t all_len = 0;
+
if (sysctlbyname("kern.module_path", NULL, &buflen, NULL, 0) < 0)
errx(1, "Can't find kernel module path.");
modpath = malloc(buflen);
@@ -111,13 +114,39 @@
errx(1, "Can't find kernel module path.");
p = modpath;
while ((q = strsep(&p, ";")) != NULL) {
+ void *h;
+
snprintf(fn, sizeof(fn), "%s/linker.hints", q);
- hints = read_hints(fn, &len);
- if (hints == NULL)
+ h = read_hints(fn, &len);
+ if (h == NULL)
continue;
- break;
+ if (len < sizeof(int) ||
+ *(int *)(intptr_t)h != LINKER_HINTS_VERSION) {
+ free(h);
+ continue;
+ }
+ if (all_hints == NULL) {
+ all_hints = h;
+ all_len = len;
+ } else {
+ void *merged;
+
+ merged = realloc(all_hints, all_len + len - sizeof(int));
+ if (merged == NULL) {
+ free(h);
+ continue;
+ }
+ all_hints = merged;
+ memcpy((char *)all_hints + all_len,
+ (char *)h + sizeof(int),
+ len - sizeof(int));
+ all_len += len - sizeof(int);
+ free(h);
+ }
}
- if (q == NULL) {
+ hints = all_hints;
+ len = all_len;
+ if (hints == NULL) {
if (quiet_flag)
exit(EX_UNAVAILABLE);
else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 15, 5:25 PM (5 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32744560
Default Alt Text
D56847.id177301.diff (1 KB)
Attached To
Mode
D56847: devmatch: read linker.hints from all module paths
Attached
Detach File
Event Timeline
Log In to Comment