[PATCH 1/2] copy: log the error number when failing to write

Christoph Hellwig <[email protected]> Wed, 29 Jul 2026 14:51:33 +0200
Newsgroups org.kernel.vger.linux-xfs
Message-ID <[email protected]>
Log the string form of the errno value to help debugging a failed write.

Signed-off-by: Christoph Hellwig <[email protected]>
---
 copy/xfs_copy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 3ba9a07e4469..ad18ceb1ac1b 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -891,8 +891,8 @@ main(int argc, char **argv)
 			off -= XFS_MAX_SECTORSIZE;
 			len = pwrite(target[i].fd, lb, XFS_MAX_SECTORSIZE, off);
 			if (len < 0) {
-				do_log(_("%s:  failed to write last block\n"),
-					progname);
+				do_log(_("%s:  failed to write last block: %s\n"),
+					progname, strerror(errno));
 				do_log(_("\tIs target \"%s\" too small?\n"),
 					target[i].name);
 				die_perror();
-- 
2.53.0