Fix assertion failure in file_tree_read when read operation fails
Initialize *gen to NO_GENERATION at the start of file_tree_read so that error paths (FILETREE_BADPATH, FILETREE_NOENT, FILETREE_ISDIR) have a well-defined value. Previously, when file_tree_read failed, gen was uninitialized, causing the assertion in process_client_read to fire. The assertion checking gen != NO_GENERATION before the error check was removed since: 1. On error paths, gen is not used 2. On success paths, the assertion at line 482 already validates gen
This commit is contained in:
@@ -513,6 +513,9 @@ int file_tree_read(FileTree *ft, string path,
|
||||
uint64_t off, uint64_t len, uint64_t *gen, uint64_t *chunk_size,
|
||||
SHA256 *hashes, int max_hashes, uint64_t *actual_bytes)
|
||||
{
|
||||
// Initialize gen to NO_GENERATION so error paths have a well-defined value
|
||||
*gen = NO_GENERATION;
|
||||
|
||||
int num_comps;
|
||||
string comps[MAX_COMPS];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user