]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootspec: make pe_find_uki_sections() non-static
authorLennart Poettering <lennart@amutable.com>
Fri, 13 Mar 2026 21:52:18 +0000 (22:52 +0100)
committerLennart Poettering <lennart@amutable.com>
Fri, 1 May 2026 05:10:31 +0000 (07:10 +0200)
src/shared/bootspec.c
src/shared/bootspec.h

index 3338d75f660df13f967717b6094320d6a572e95a..ebd63788c0ad1ba59da2d83a279e17437a08ee69 100644 (file)
@@ -963,7 +963,7 @@ static int trim_cmdline(char **cmdline) {
  * the ones we do care about and we are willing to load into memory have this size limit.) */
 #define PE_SECTION_SIZE_MAX (4U*1024U*1024U)
 
-static int pe_find_uki_sections(
+int pe_find_uki_sections(
                 int fd,
                 const char *path,
                 unsigned profile,
@@ -979,9 +979,6 @@ static int pe_find_uki_sections(
         assert(fd >= 0);
         assert(path);
         assert(profile != UINT_MAX);
-        assert(ret_osrelease);
-        assert(ret_profile);
-        assert(ret_cmdline);
 
         r = pe_load_headers_and_sections(fd, path, &sections, &pe_header);
         if (r < 0)
@@ -1038,13 +1035,22 @@ static int pe_find_uki_sections(
         if (trim_cmdline(&cmdline_text) < 0)
                 return log_oom();
 
-        *ret_osrelease = TAKE_PTR(osrelease_text);
-        *ret_profile = TAKE_PTR(profile_text);
-        *ret_cmdline = TAKE_PTR(cmdline_text);
+        if (ret_osrelease)
+                *ret_osrelease = TAKE_PTR(osrelease_text);
+        if (ret_profile)
+                *ret_profile = TAKE_PTR(profile_text);
+        if (ret_cmdline)
+                *ret_cmdline = TAKE_PTR(cmdline_text);
         return 1;
 
 nothing:
-        *ret_osrelease = *ret_profile = *ret_cmdline = NULL;
+        if (ret_osrelease)
+                *ret_osrelease = NULL;
+        if (ret_profile)
+                *ret_profile = NULL;
+        if (ret_cmdline)
+                *ret_cmdline = NULL;
+
         return 0;
 }
 
index afc5a576c9048d8eedb1991028203987158ed713..01abe05e72dd9621ca1ad0df69b7c4f206a99e0e 100644 (file)
@@ -162,3 +162,5 @@ int show_boot_entries(
 int boot_filename_extract_tries(const char *fname, char **ret_stripped, unsigned *ret_tries_left, unsigned *ret_tries_done);
 
 int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret);
+
+int pe_find_uki_sections(int fd, const char *path, unsigned profile, char **ret_osrelease, char **ret_profile, char **ret_cmdline);