git: a18be39aafc1 - main - makefs: Initialize cd9660 inode map only once
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Mar 2025 13:35:41 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=a18be39aafc1b55fd67603ee6a6d820d0fcd877f
commit a18be39aafc1b55fd67603ee6a6d820d0fcd877f
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-03-01 13:30:52 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-03-01 13:35:15 +0000
makefs: Initialize cd9660 inode map only once
Error introduced during a refactoring; cd9660_susp_initialize calls
itself recursively.
Sponsred by: The FreeBSD Foundation
Fixes: 35a2e286157a ("makefs: Record inode for all entries in mtree mode")
---
usr.sbin/makefs/cd9660/iso9660_rrip.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c
index 1b8ce42da4c0..31c6e38a96fe 100644
--- a/usr.sbin/makefs/cd9660/iso9660_rrip.c
+++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c
@@ -70,8 +70,10 @@ cd9660_susp_initialize(iso9660_disk *diskStructure, cd9660node *node,
if (node->dot_dot_record != 0)
TAILQ_INIT(&(node->dot_dot_record->head));
- RB_INIT(&diskStructure->rr_inode_map);
- diskStructure->rr_inode_next = 1;
+ if (diskStructure->rr_inode_next == 0) {
+ RB_INIT(&diskStructure->rr_inode_map);
+ diskStructure->rr_inode_next = 1;
+ }
/* SUSP specific entries here */
if ((r = cd9660_susp_initialize_node(diskStructure, node)) < 0)
@@ -121,11 +123,15 @@ cd9660_susp_finalize(iso9660_disk *diskStructure, cd9660node *node)
if ((r = cd9660_susp_finalize(diskStructure, temp)) < 0)
return r;
}
- RB_FOREACH_SAFE(mapnode, inode_map_tree,
- &(diskStructure->rr_inode_map), mapnodetmp) {
- RB_REMOVE(inode_map_tree, &(diskStructure->rr_inode_map),
- mapnode);
- free(mapnode);
+
+ if (diskStructure->rr_inode_next != 0) {
+ RB_FOREACH_SAFE(mapnode, inode_map_tree,
+ &(diskStructure->rr_inode_map), mapnodetmp) {
+ RB_REMOVE(inode_map_tree,
+ &(diskStructure->rr_inode_map), mapnode);
+ free(mapnode);
+ }
+ diskStructure->rr_inode_next = 0;
}
return 1;
}