Commit 6eb838d
committed
fix(locking): prevent lock fd inheritance and add read-only C open (#2)
## Summary
- set close-on-exec for file open/create paths to prevent lock FD
inheritance across exec
- add `zvec_open_read_only(const char* path, zvec_collection_t* out)` C
API and open collection with `read_only_=true`
- add regression tests for CLOEXEC behavior and lock FD inheritance
across fork+exec
- fix the lock-inheritance regression test to move ownership from the
create result and avoid shared ownership false negatives
## Testing
- `./build-1349/bin/file_test
--gtest_filter=File.CreateAndOpen_SetsCloseOnExecFlag`
- `./build-1349/bin/collection_test
--gtest_filter=CollectionTest.Feature_LockFdIsNotInheritedAcrossExec`1 parent deedd32 commit 6eb838d
File tree
5 files changed
+307
-177
lines changed- src
- ailego/io
- binding/c
- tests
- ailego/io
- db
5 files changed
+307
-177
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
42 | 86 | | |
43 | 87 | | |
44 | 88 | | |
| |||
144 | 188 | | |
145 | 189 | | |
146 | 190 | | |
147 | | - | |
| 191 | + | |
148 | 192 | | |
149 | 193 | | |
150 | 194 | | |
| |||
178 | 222 | | |
179 | 223 | | |
180 | 224 | | |
181 | | - | |
| 225 | + | |
182 | 226 | | |
183 | 227 | | |
184 | 228 | | |
| |||
724 | 768 | | |
725 | 769 | | |
726 | 770 | | |
727 | | - | |
| 771 | + | |
0 commit comments