-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: read/write fd dropped unexpectedly.
read/write function invokes ``` self.check_fd_flags(data, f.as_raw_fd(), flags)?; ``` which takes ownership of `data` and it's inner `File`, after the function call returns, File will be dropped and cannot be read/write later anymore, causing a failed read/write. This bug is triggered when `no_open` config option is set, in this case, `self.get_data` opens a new file and it's dropped immediately after `check_fd_flags`. The bug can be solved by create a new clone of data by `data.clone()`, the original data(and inner File) can be kept in whole lifetime of read/write function. Signed-off-by: Wei Zhang <[email protected]>
- Loading branch information
1 parent
e58bcef
commit 8e289bd
Showing
3 changed files
with
147 additions
and
5 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