From c445ea62668b2e3ae9071047368328db9bad8ea7 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 25 Oct 2023 02:43:02 +0300 Subject: [PATCH] cp: abort copy if write fails --- userspace/cp/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userspace/cp/main.cpp b/userspace/cp/main.cpp index 2e0c263c4a..bfd2a8a8f6 100644 --- a/userspace/cp/main.cpp +++ b/userspace/cp/main.cpp @@ -69,7 +69,7 @@ bool copy_file(const BAN::String& source, BAN::String destination) perror("write"); ret = false; } - if (nwrite == 0) + if (nwrite <= 0) break; written += nwrite; }