Skip to content

Commit 784c1a4

Browse files
committed
Fix for directories with size 0
1 parent 36e10b9 commit 784c1a4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

extract-xiso.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,10 +1343,13 @@ int process_node(int in_xiso, dir_node* node, char* in_path, modes in_mode, dir_
13431343

13441344
if (!err) {
13451345
// Recurse on subdirectory
1346-
if (!err && node->file_size > 0) {
1347-
if (in_path) if (asprintf(&path, "%s%s%c", in_path, node->filename, PATH_CHAR) == -1) mem_err();
1348-
end_offset = n_sectors(node->file_size) * XISO_SECTOR_SIZE / XISO_DWORD_SIZE;
1349-
err = traverse_xiso(in_xiso, dir_start, 0, end_offset, path, in_mode, in_root, strategy);
1346+
if (node->file_size == 0) *in_root = EMPTY_SUBDIRECTORY;
1347+
else {
1348+
if (in_path && asprintf(&path, "%s%s%c", in_path, node->filename, PATH_CHAR) == -1) mem_err();
1349+
if (!err) {
1350+
end_offset = n_sectors(node->file_size) * XISO_SECTOR_SIZE / XISO_DWORD_SIZE;
1351+
err = traverse_xiso(in_xiso, dir_start, 0, end_offset, path, in_mode, in_root, strategy);
1352+
}
13501353
if (path) free(path);
13511354
}
13521355

0 commit comments

Comments
 (0)