diff options
author | Jan Janssen <medhefgo@web.de> | 2021-11-15 12:48:47 +0100 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2021-11-29 16:20:45 +0100 |
commit | ccfbdbdcabd194bb14148a4f26cf4b3128a5bbf7 (patch) | |
tree | 91a6d1d98b554f70bbda20b49058c6b4116a9f3e | |
parent | sd-boot: Make stra_to_path/stra_to_str non-failing (diff) | |
download | systemd-ccfbdbdcabd194bb14148a4f26cf4b3128a5bbf7.tar.xz systemd-ccfbdbdcabd194bb14148a4f26cf4b3128a5bbf7.zip |
sd-boot: Simplify path creation
-rw-r--r-- | src/boot/efi/cpio.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c index 1818fbedd0..109003e9de 100644 --- a/src/boot/efi/cpio.c +++ b/src/boot/efi/cpio.c @@ -330,7 +330,7 @@ EFI_STATUS pack_cpio( _cleanup_(FileHandleClosep) EFI_FILE_HANDLE root = NULL, extra_dir = NULL; UINTN dirent_size = 0, buffer_size = 0, n_items = 0, n_allocated = 0; - _cleanup_freepool_ CHAR16 *loaded_image_path = NULL, *j = NULL; + _cleanup_freepool_ CHAR16 *extra_dir_path = NULL; _cleanup_freepool_ EFI_FILE_INFO *dirent = NULL; _cleanup_(strv_freep) CHAR16 **items = NULL; _cleanup_freepool_ void *buffer = NULL; @@ -346,15 +346,11 @@ EFI_STATUS pack_cpio( if (!root) return log_error_status_stall(EFI_LOAD_ERROR, L"Unable to open root directory."); - loaded_image_path = DevicePathToStr(loaded_image->FilePath); - if (!loaded_image_path) + extra_dir_path = PoolPrint(L"%D" EXTRA_DIR_SUFFIX, loaded_image->FilePath); + if (!extra_dir_path) return log_oom(); - j = PoolPrint(L"%s" EXTRA_DIR_SUFFIX, loaded_image_path); - if (!j) - return log_oom(); - - err = open_directory(root, j, &extra_dir); + err = open_directory(root, extra_dir_path, &extra_dir); if (err == EFI_NOT_FOUND) { /* No extra subdir, that's totally OK */ *ret_buffer = NULL; |