jcs
/amend
/amendments
/167
bile: Don't re-use deleted id
jcs made amendment 167 14 days ago
--- bile.c Wed Oct 2 12:16:30 2024
+++ bile.c Mon Sep 28 13:51:53 2026
@@ -384,7 +384,7 @@ bile_next_id(struct bile *bile, const OSType type)
if (bile_read(bile, BILE_TYPE_HIGHESTID, type, &highest,
sizeof(unsigned long)) == sizeof(unsigned long)) {
- if (highest > id)
+ if (highest >= id)
id = highest + 1;
}
@@ -823,14 +823,9 @@ bile_alloc(struct bile *bile, const OSType type, const
*/
map_pos = bile->nobjects;
- for (n = 0; n + 1 < bile->nobjects; n++) {
- if (n == 0 && last_pos < bile->map[n].pos) {
- map_pos = 0;
- break;
- }
- if (last_pos > bile->map[n].pos &&
- last_pos < bile->map[n + 1].pos) {
- map_pos = n + 1;
+ for (n = 0; n < bile->nobjects; n++) {
+ if (bile->map[n].pos > last_pos) {
+ map_pos = n;
break;
}
}