mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: consolidate error reporting
Consolidate error reporting to make sure that error messages are used consistently. In addition, don't call `zg_exit()` directly, but instead return the value 1 in `main()`. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
73c3a9e684
commit
f957d895cd
@@ -26,6 +26,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib/zt_common.h"
|
||||
#include "zgetdump.h"
|
||||
#include "dt.h"
|
||||
#include "dfi.h"
|
||||
@@ -105,6 +106,12 @@ static void kdump_select_check(void)
|
||||
ERR_EXIT("%s", msg);
|
||||
}
|
||||
|
||||
static int dfi_init_error(int UNUSED(rc))
|
||||
{
|
||||
STDERR("Dump cannot be processed (is not complete)\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run "--umount" action
|
||||
*/
|
||||
@@ -129,10 +136,13 @@ static int do_device_info(void)
|
||||
*/
|
||||
static int do_dump_info(void)
|
||||
{
|
||||
if (dfi_init() != 0) {
|
||||
int rc;
|
||||
|
||||
rc = dfi_init();
|
||||
if (rc != 0) {
|
||||
dfi_info_print();
|
||||
STDERR("\nERROR: Dump is not complete\n");
|
||||
zg_exit(1);
|
||||
STDERR("\n");
|
||||
return dfi_init_error(rc);
|
||||
}
|
||||
kdump_select_check();
|
||||
dfi_info_print();
|
||||
@@ -147,8 +157,9 @@ static int do_mount(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (dfi_init() != 0)
|
||||
ERR_EXIT("Dump cannot be processed (is not complete)");
|
||||
rc = dfi_init();
|
||||
if (rc != 0)
|
||||
return dfi_init_error(rc);
|
||||
dfo_init();
|
||||
kdump_select_check();
|
||||
rc = zfuse_mount_dump();
|
||||
@@ -189,8 +200,9 @@ static int do_copy(const char *output)
|
||||
FILE *stream;
|
||||
int rc;
|
||||
|
||||
if (dfi_init() != 0)
|
||||
ERR_EXIT("Dump cannot be processed (is not complete)");
|
||||
rc = dfi_init();
|
||||
if (rc != 0)
|
||||
return dfi_init_error(rc);
|
||||
dfo_init();
|
||||
kdump_select_check();
|
||||
stream = open_file_for_writing(output);
|
||||
|
||||
Reference in New Issue
Block a user