aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-01-09 12:31:55 +0000
committerJames Bottomley <JBottomley@Parallels.com>2013-01-09 12:31:55 +0000
commit706aef684ea359ea091f7884a9d118ab10c738d3 (patch)
tree161371ee4478be142389bf94712d1cf0acac9192
parent0ac83f86a46e6e92a6c32d610d48d93c169727c4 (diff)
downloadefitools-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.c11
-rw-r--r--lib/simple_file.c4
2 files changed, 8 insertions, 7 deletions
diff --git a/KeyTool.c b/KeyTool.c
index 4a5f6b4..27c53d5 100644
--- a/KeyTool.c
+++ b/KeyTool.c
@@ -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;
}