-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/hash_index: fix hash_index fd ownership handling
When calling r_hash_index_open(), the ownership of the file descriptor provided should be handed over to the hash index and will be later closed in r_hash_index_free(). Thus, the file descriptor provided must not be freed by the calling code anymore. In r_hash_index_open_image() is was manually handled by setting data_fd = -1; after sucessfully opening the hash index. In generate_adaptive_data() however, this manual resetting of the pointer was missing and the fd was closed manually in later error handling. This could lead to cases where a double-call of g_close() on the same pointer happened. This was wrong anyway but results in a critical error in RAUC since glib version 2.75.0 which comes with a more pickier g_close() handling: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2964 Since the need to manually set the fd to -1 seems error-prone anyway, we just change r_hash_index_open() to handle this itself by passing the fd as a pointer. Signed-off-by: Enrico Joerns <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters