libcareplus/libcare-dump-change-the-return-value.patch
yezengruan 5138d02845 update spec with openeuler !31 !4
libcare-dump: change the return value
gensrc: skip vector instruction in str_do_gotpcrel

Signed-off-by: yezengruan <yezengruan@huawei.com>
(cherry picked from commit c1712c9eb7c34f10f44dd0e1688acc713cbb98b6)
2022-05-11 17:00:11 +08:00

39 lines
1.1 KiB
Diff

From 037c9ac7e9d3eaa072ae1edaad2bc22e18f4333a Mon Sep 17 00:00:00 2001
From: jiang-dawei15 <jiangdawei15@huawei.com>
Date: Thu, 5 May 2022 10:39:47 +0800
Subject: [PATCH] libcare-dump:change the return value
---
src/libcare-dump.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/libcare-dump.c b/src/libcare-dump.c
index 8736452..b712709 100644
--- a/src/libcare-dump.c
+++ b/src/libcare-dump.c
@@ -45,6 +45,7 @@ void usage()
int kpatch_dump_kpatch_header(const char *input_file)
{
+ int rv;
int fdi = -1;
int ret = -1;
int elf_size;
@@ -67,7 +68,12 @@ int kpatch_dump_kpatch_header(const char *input_file)
goto cleanup;
}
- ret = read(fdi, &kp, sizeof(struct kpatch_file));
+ rv = read(fdi, &kp, sizeof(struct kpatch_file));
+ if (rv <= 0) {
+ printf("Read kpatch file '%s' failed.\n", input_file);
+ goto cleanup;
+ }
+ ret = 0;
printf("%-25s %s\n", "Patch Name:", input_file);
printf("%-25s %s\n", "Magic:", kp.magic);
printf("%-25s %s\n", "Patch id:", kp.id);
--
2.27.0