mirror of
https://github.com/systemd/systemd.git
synced 2025-02-01 09:47:35 +03:00
portable: use parse_env_file_fd to keep FD valid
take_fdopen_unlocked invalidates the FD in the PortableMetadata object, so it cannot be used later. Use parse_env_file_fd instead which is non destructive.
This commit is contained in:
parent
2ed74695b3
commit
62b7c23f79
@ -566,14 +566,9 @@ static int extract_image_and_extensions(
|
||||
* extension-release metadata match, otherwise reject it immediately as invalid, or it will fail when
|
||||
* the units are started. Also, collect valid portable prefixes if caller requested that. */
|
||||
if (validate_sysext || ret_valid_prefixes) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_free_ char *prefixes = NULL;
|
||||
|
||||
r = take_fdopen_unlocked(&os_release->fd, "r", &f);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = parse_env_file(f, os_release->name,
|
||||
r = parse_env_file_fd(os_release->fd, os_release->name,
|
||||
"ID", &id,
|
||||
"VERSION_ID", &version_id,
|
||||
"SYSEXT_LEVEL", &sysext_level,
|
||||
|
Loading…
x
Reference in New Issue
Block a user