repo/extra/efibootmgr/patches/fix-verbose.patch
2020-01-07 13:25:46 +02:00

86 lines
2.6 KiB
Diff

diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index de38f01..2ebc312 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -951,47 +951,64 @@ show_vars(const char *prefix)
dp = efi_loadopt_path(load_option, boot->data_size);
rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
- if (rc < 0)
- error(18, "Could not parse device path");
+ if (rc < 0) {
+ warning("Could not parse device path");
+ return;
+ }
rc += 1;
text_path_len = rc;
text_path = calloc(1, rc);
- if (!text_path)
- error(19, "Could not parse device path");
+ if (!text_path) {
+ warning("Could not parse device path");
+ return;
+ }
rc = efidp_format_device_path(text_path, text_path_len,
dp, pathlen);
- if (rc < 0)
- error(20, "Could not parse device path");
- printf("\t%s", text_path);
+ if (rc >= 0)
+ printf("\t%s", text_path);
free(text_path);
+ if (rc < 0) {
+ warning("Could not parse device path");
+ return;
+ }
+
/* Print optional data */
rc = efi_loadopt_optional_data(load_option,
boot->data_size,
&optional_data,
&optional_data_len);
- if (rc < 0)
- error(21, "Could not parse optional data");
+ if (rc < 0) {
+ warning("Could not parse optional data");
+ return;
+ }
if (opts.unicode) {
text_path = ucs2_to_utf8((uint16_t*)optional_data, optional_data_len/2);
} else {
rc = unparse_raw_text(NULL, 0, optional_data,
optional_data_len);
- if (rc < 0)
- error(22, "Could not parse optional data");
+ if (rc < 0) {
+ warning("Could not parse optional data");
+ return;
+ }
rc += 1;
text_path_len = rc;
text_path = calloc(1, rc);
- if (!text_path)
- error(23, "Could not parse optional data");
+ if (!text_path) {
+ warning("Could not parse optional data");
+ return;
+ }
rc = unparse_raw_text(text_path, text_path_len,
optional_data, optional_data_len);
- if (rc < 0)
- error(24, "Could not parse device path");
- }
+ if (rc < 0) {
+ warning("Could not parse device path");
+ free(text_path);
+ return;
+ }
+ }
printf("%s", text_path);
free(text_path);
}