diff options
author | James Bottomley <JBottomley@Parallels.com> | 2013-01-09 12:31:55 +0000 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-01-09 12:31:55 +0000 |
commit | 706aef684ea359ea091f7884a9d118ab10c738d3 (patch) | |
tree | 161371ee4478be142389bf94712d1cf0acac9192 | |
parent | 0ac83f86a46e6e92a6c32d610d48d93c169727c4 (diff) | |
download | efitools-706aef684ea359ea091f7884a9d118ab10c738d3.tar.gz |
KeyTool: Better errors on save keys
some platforms (tianocore) are giving invalid parameter occasionally to the
request to save keys in the root->Open function. Still no idea why, but make
sure diagnosis is easier.
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | KeyTool.c | 11 | ||||
-rw-r--r-- | lib/simple_file.c | 4 |
2 files changed, 8 insertions, 7 deletions
@@ -469,7 +469,8 @@ save_key_internal(int key, EFI_HANDLE vol, CHAR16 *error) if (status == EFI_NOT_FOUND) StrCat(error, L": Variable has no entries"); else - StrCat(error, L": Failed to get variable"); + SPrint(error, 1024, L"%s: Failed to get variable (Error: %d)", + error, status); return; } StrCpy(file_name, L"\\"); @@ -480,15 +481,15 @@ save_key_internal(int key, EFI_HANDLE vol, CHAR16 *error) | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE); if (status != EFI_SUCCESS) { - StrCat(error, L": Failed to open file for writing: "); - StrCat(error, file_name); + SPrint(error, 1024, L"%s: Failed to open file %s (Error: %d)", + error, file_name, status); return; } status = simple_file_write_all(file, len, data); simple_file_close(file); if (status != EFI_SUCCESS) { - StrCat(error, L": Failed to write to "); - StrCat(error, file_name); + SPrint(error, 1024, L"%s: Failed to write to %s (Error: %d)", + error, file_name, status); return; } StrCat(error, L": Successfully written to "); diff --git a/lib/simple_file.c b/lib/simple_file.c index 40ebf27..0e5ecd2 100644 --- a/lib/simple_file.c +++ b/lib/simple_file.c @@ -28,14 +28,14 @@ simple_file_open_by_handle(EFI_HANDLE device, CHAR16 *name, EFI_FILE **file, UIN &SIMPLE_FS_PROTOCOL, &drive); if (efi_status != EFI_SUCCESS) { - Print(L"Unable to find simple file protocol\n"); + Print(L"Unable to find simple file protocol (%d)\n", efi_status); goto error; } efi_status = uefi_call_wrapper(drive->OpenVolume, 2, drive, &root); if (efi_status != EFI_SUCCESS) { - Print(L"Failed to open drive volume\n"); + Print(L"Failed to open drive volume (%d)\n", efi_status); goto error; } |