cp: abort copy if write fails

This commit is contained in:
Bananymous 2023-10-25 02:43:02 +03:00
parent 7a54a088b4
commit 9e4adc1264
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ bool copy_file(const BAN::String& source, BAN::String destination)
perror("write"); perror("write");
ret = false; ret = false;
} }
if (nwrite == 0) if (nwrite <= 0)
break; break;
written += nwrite; written += nwrite;
} }