@@ -24,9 +24,11 @@ auto FastDevAssemblies::open_assembly (std::string_view const& name, int64_t &si
24
24
return nullptr ;
25
25
}
26
26
27
- if (override_dir_fd == -1 ) [[unlikely]] {
27
+ // NOTE: override_dir will be kept open, we have no way of knowing when it will be no longer
28
+ // needed
29
+ if (override_dir_fd < 0 ) [[unlikely]] {
28
30
std::lock_guard dir_lock { override_dir_lock };
29
- if (override_dir_fd == - 1 ) [[likely]] {
31
+ if (override_dir_fd < 0 ) [[likely]] {
30
32
override_dir = opendir (override_dir_path.c_str ());
31
33
if (override_dir == nullptr ) [[unlikely]] {
32
34
log_warn (LOG_ASSEMBLY, " Failed to open override dir '{}'. {}" , override_dir_path, strerror (errno));
@@ -44,27 +46,14 @@ auto FastDevAssemblies::open_assembly (std::string_view const& name, int64_t &si
44
46
);
45
47
46
48
if (!Util::file_exists (override_dir_fd, name)) {
47
- log_warn (
48
- LOG_ASSEMBLY,
49
- " FastDev assembly '{}' not found." ,
50
- name
51
- );
49
+ log_warn (LOG_ASSEMBLY, " FastDev assembly '{}' not found." , name);
52
50
return nullptr ;
53
51
}
54
-
55
- log_debug (
56
- LOG_ASSEMBLY,
57
- " Found FastDev assembly '{}'" ,
58
- name
59
- );
52
+ log_debug (LOG_ASSEMBLY, " Found FastDev assembly '{}'" , name);
60
53
61
54
auto file_size = Util::get_file_size_at (override_dir_fd, name);
62
55
if (!file_size) [[unlikely]] {
63
- log_warn (
64
- LOG_ASSEMBLY,
65
- " Unable to determine FastDev assembly '{}' file size" ,
66
- name
67
- );
56
+ log_warn (LOG_ASSEMBLY, " Unable to determine FastDev assembly '{}' file size" , name);
68
57
return nullptr ;
69
58
}
70
59
@@ -118,13 +107,7 @@ auto FastDevAssemblies::open_assembly (std::string_view const& name, int64_t &si
118
107
size = 0 ;
119
108
return nullptr ;
120
109
}
121
-
122
- log_debug (
123
- LOG_ASSEMBLY,
124
- " Read {} bytes of FastDev assembly '{}'" ,
125
- nread,
126
- name
127
- );
110
+ log_debug (LOG_ASSEMBLY, " Read {} bytes of FastDev assembly '{}'" , nread, name);
128
111
129
112
return reinterpret_cast <void *>(buffer);
130
113
}
0 commit comments