Skip to content

Commit

Permalink
read external files before modifying the entry's path
Browse files Browse the repository at this point in the history
  • Loading branch information
calccrypto committed Feb 14, 2025
1 parent 3dc8d6f commit f54ec98
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/gufi_dir2index.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ static int process_nondir(struct work *entry, struct entry_data *ed, void *args)
nda->xattrs_res, nda->xattr_files_res);
}

/* read external files before modifying the entry's path */
if (strncmp(entry->name + entry->name_len - entry->basename_len,
EXTERNAL_DB_USER_FILE, EXTERNAL_DB_USER_FILE_LEN + 1) == 0) {
external_read_file(in, entry, process_external, nda->db);
}

/* get entry relative path (use extra buffer to prevent memcpy overlap) */
char relpath[MAXPATH];
const size_t relpath_len = SNFORMAT_S(relpath, MAXPATH, 1,
Expand All @@ -162,11 +168,6 @@ static int process_nondir(struct work *entry, struct entry_data *ed, void *args)
/* add entry + xattr names into bulk insert */
insertdbgo(entry, ed, nda->entries_res);

if (strncmp(entry->name + entry->name_len - entry->basename_len,
EXTERNAL_DB_USER_FILE, EXTERNAL_DB_USER_FILE_LEN + 1) == 0) {
external_read_file(in, entry, process_external, nda->db);
}

out:
return rc;
}
Expand Down

0 comments on commit f54ec98

Please sign in to comment.