From: Jan Janssen Date: Mon, 15 Nov 2021 11:48:47 +0000 (+0100) Subject: sd-boot: Simplify path creation X-Git-Tag: v250-rc1~48^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccfbdbdcabd194bb14148a4f26cf4b3128a5bbf7;p=thirdparty%2Fsystemd.git sd-boot: Simplify path creation --- diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c index 1818fbedd08..109003e9de3 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;