mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump: stdout_write_dump: if dfo_size() == 0 then don't enter the loop
While at it, decrease the scope of @cnt and @rc. 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
15774dbe32
commit
524017ac06
@@ -17,9 +17,8 @@
|
||||
int stdout_write_dump(void)
|
||||
{
|
||||
const u64 output_size = dfo_size();
|
||||
u64 cnt, written = 0;
|
||||
u64 written = 0;
|
||||
char buf[32768];
|
||||
ssize_t rc;
|
||||
|
||||
if (!dfi_feat_copy())
|
||||
ERR_EXIT("Copying not possible for %s dumps", dfi_name());
|
||||
@@ -28,7 +27,10 @@ int stdout_write_dump(void)
|
||||
STDERR(" Target: %s\n", dfo_name());
|
||||
STDERR("\n");
|
||||
zg_progress_init("Copying dump", output_size);
|
||||
do {
|
||||
while (written != output_size) {
|
||||
ssize_t rc;
|
||||
u64 cnt;
|
||||
|
||||
cnt = dfo_read(buf, sizeof(buf));
|
||||
rc = write(STDOUT_FILENO, buf, cnt);
|
||||
if (rc == -1)
|
||||
@@ -37,7 +39,7 @@ int stdout_write_dump(void)
|
||||
ERR_EXIT("Error: Could not write full block");
|
||||
written += cnt;
|
||||
zg_progress(written);
|
||||
} while (written != output_size);
|
||||
};
|
||||
STDERR("\n");
|
||||
STDERR("Success: Dump has been copied\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user