From c084bef64ac7aaebb3bb2b74038cdcbacecd2797 Mon Sep 17 00:00:00 2001 From: Patrick Rouleau Date: Mon, 7 Jul 2014 23:48:22 -0400 Subject: [PATCH] io_all(): log the right operation name when the operation returns 0 The previous code was always logging: "io_all: rescue write size = " even for a read. Signed-off-by: Patrick Rouleau --- src/partclone.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/partclone.c b/src/partclone.c index ca5f9886..21b1d1a7 100644 --- a/src/partclone.c +++ b/src/partclone.c @@ -1485,6 +1485,7 @@ int io_all(int *fd, char *buf, unsigned long long count, int do_write, cmd_opt* int debug = opt->debug; unsigned long long size = count; extern unsigned long long rescue_write_size; + const char * const action = do_write ? "write" : "read"; // for sync I/O buffer, when use stdin or pipe. while (count > 0) { @@ -1501,13 +1502,13 @@ int io_all(int *fd, char *buf, unsigned long long count, int do_write, cmd_opt* } else if (i == 0) { log_mesg(1, 0, 1, debug, "%s: nothing to read. errno = %i(%s)\n",__func__, errno, strerror(errno)); rescue_write_size = size - count; - log_mesg(1, 0, 0, debug, "%s: rescue write size = %llu\n",__func__, rescue_write_size); + log_mesg(1, 0, 0, debug, "%s: rescue %s size = %llu\n",__func__, action, rescue_write_size); return 0; } else { count -= i; buf = i + (char *) buf; log_mesg(2, 0, 0, debug, "%s: %s %lli, %llu left.\n", - __func__, do_write ? "write" : "read", i, count); + __func__, action, i, count); } } return size;