mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
scripts: generate_rust_analyzer.py: avoid FD leak
Use `pathlib.Path.read_text()` to avoid leaking file descriptors.
Fixes: 8c4555ccc5 ("scripts: add `generate_rust_analyzer.py`")
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Link: https://patch.msgid.link/20260127-rust-analyzer-fd-leak-v2-1-1bb55b9b6822@kernel.org
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
This commit is contained in:
parent
36c619f6bd
commit
9b4744d8ed
|
|
@ -313,9 +313,10 @@ def generate_crates(
|
|||
|
||||
def is_root_crate(build_file: pathlib.Path, target: str) -> bool:
|
||||
try:
|
||||
return f"{target}.o" in open(build_file).read()
|
||||
contents = build_file.read_text()
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
return f"{target}.o" in contents
|
||||
|
||||
# Then, the rest outside of `rust/`.
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user