diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_append.c index 026bc8d..362b85b 100644 --- a/src/logic/tpax_archive_append.c +++ b/src/logic/tpax_archive_append.c @@ -454,10 +454,14 @@ int tpax_archive_append_item( const struct tpax_unit_ctx * uctx) { int fdat; + uintptr_t addr; const char * name; const char * mark; const char * prefix; bool fkeep; + struct tpax_dirent_buffer * dentbuf; + struct tpax_dirent * cdent; + struct tpax_dirent * cnext; struct dirent * dirent; char entbuf[PATH_MAX + sizeof(struct dirent)]; @@ -499,8 +503,28 @@ int tpax_archive_append_item( TPAX_NESTED_ERROR(dctx), 0); + /* queue directory child items */ + dentbuf = tpax_get_driver_dirents(dctx); + cdent = tpax_get_driver_dirmark(dctx); + + for (; cdent; ) { + if (cdent->dirent.d_type == DT_DIR) + if (tpax_archive_append_dir_entries(dctx,cdent) < 0) + return TPAX_NESTED_ERROR(dctx); + + addr = (uintptr_t)cdent; + addr += cdent->nsize; + cnext = (struct tpax_dirent *)addr; + + if (cnext == dentbuf->cdent) { + dentbuf = dentbuf->next; + cnext = dentbuf ? dentbuf->dbuf : 0; + } + + cdent = cnext; + } + (void)tpax_archive_append_pad; - (void)tpax_archive_append_dir_entries; return 0; }