Commit f76c87a
committed
utl: ensure exception-safe file closure in stream and file handlers
Addresses an issue where utl::OutStreamHandler could cause a crash
(std::terminate) if a file flush or rename failed during destruction
(e.g., due to ENOSPC).
- Added explicit close() methods to OutStreamHandler, InStreamHandler,
and FileHandler to allow users to handle closure errors explicitly.
- Updated destructors to be exception-safe by catching potential errors
during implicit closure.
- Added diagnostic logging to std::cerr in destructors to report
closure failures that would otherwise be suppressed.
Fixes #9252
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>1 parent 0c68cb3 commit f76c87a
File tree
2 files changed
+53
-7
lines changed- src/utl
- include/utl
- src
2 files changed
+53
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
98 | 112 | | |
99 | 113 | | |
100 | 114 | | |
| |||
105 | 119 | | |
106 | 120 | | |
107 | 121 | | |
| 122 | + | |
| 123 | + | |
108 | 124 | | |
109 | | - | |
110 | | - | |
111 | 125 | | |
112 | 126 | | |
113 | 127 | | |
| |||
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
147 | 174 | | |
148 | 175 | | |
149 | 176 | | |
| |||
152 | 179 | | |
153 | 180 | | |
154 | 181 | | |
155 | | - | |
156 | 182 | | |
157 | 183 | | |
158 | 184 | | |
| |||
177 | 203 | | |
178 | 204 | | |
179 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
180 | 219 | | |
181 | 220 | | |
182 | | - | |
183 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
184 | 229 | | |
185 | | - | |
186 | | - | |
187 | 230 | | |
188 | 231 | | |
189 | 232 | | |
| |||
0 commit comments