mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: write_dump: use FILE *
Use the more common `FILE *` for writing to the output. Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
e9deec4c62
commit
697c5dc405
@@ -156,8 +156,9 @@ static int do_mount(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int open_file_for_writing(const char *output)
|
||||
static FILE *open_file_for_writing(const char *output)
|
||||
{
|
||||
FILE *stream;
|
||||
int fd;
|
||||
|
||||
if (output) {
|
||||
@@ -172,7 +173,12 @@ static int open_file_for_writing(const char *output)
|
||||
ERR_EXIT_ERRNO("Could not dup() stdout");
|
||||
}
|
||||
|
||||
return fd;
|
||||
stream = fdopen(fd, "w");
|
||||
if (!stream)
|
||||
ERR_EXIT_ERRNO("Could not fdopen()");
|
||||
fd = -1;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -180,15 +186,16 @@ static int open_file_for_writing(const char *output)
|
||||
*/
|
||||
static int do_copy(const char *output)
|
||||
{
|
||||
int rc, fd;
|
||||
FILE *stream;
|
||||
int rc;
|
||||
|
||||
if (dfi_init() != 0)
|
||||
ERR_EXIT("Dump cannot be processed (is not complete)");
|
||||
dfo_init();
|
||||
kdump_select_check();
|
||||
fd = open_file_for_writing(output);
|
||||
rc = write_dump(fd);
|
||||
close(fd);
|
||||
stream = open_file_for_writing(output);
|
||||
rc = write_dump(stream);
|
||||
fclose(stream);
|
||||
dfi_exit();
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user