From a8dbe93c7e07260a6849b8c779ec9dd7dc4b9e4e Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Thu, 9 Mar 2017 15:44:09 +0000 Subject: [PATCH] nica/files: Ensure we really do break on a read error Previously nc_copy_file would return true regardless of a source read error, flagged in analysis. Ensure we bypass the set of ret to true and return the correct value in all instances. Signed-off-by: Ikey Doherty --- src/nica/files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nica/files.c b/src/nica/files.c index 58c7a2b..b45fc6d 100644 --- a/src/nica/files.c +++ b/src/nica/files.c @@ -113,7 +113,7 @@ bool nc_copy_file(const char *src, const char *dst, mode_t mode, bool remove_tar while (true) { if ((r = read(src_fd, &buffer, sizeof(buffer))) < 0) { ret = false; - break; + goto end; } if (write(dest_fd, buffer, sizeof(buffer)) != r) { break;