Skip to content

Commit

Permalink
next_dir_entry: hide $Root unless in apparent root
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Jun 7, 2021
1 parent f3b5b55 commit 2733ac3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dirctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,13 @@ static NTSTATUS next_dir_entry(file_ref* fileref, uint64_t* offset, dir_entry* d
if (!dc)
return STATUS_NO_MORE_FILES;

if (dc->root_dir && fileref->parent) { // hide $Root dir unless in apparent root, to avoid recursion
if (dc->list_entry_index.Flink == &fileref->fcb->dir_children_index)
return STATUS_NO_MORE_FILES;

dc = CONTAINING_RECORD(dc->list_entry_index.Flink, dir_child, list_entry_index);
}

de->key = dc->key;
de->name = dc->name;
de->type = dc->type;
Expand Down

0 comments on commit 2733ac3

Please sign in to comment.