mirror of
https://github.com/troglobit/libite.git
synced 2026-10-01 05:22:34 +07:00
Fix copyfile() regression introduced in 4e9b5c13
Caught in release cycle. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+8
-3
@@ -71,8 +71,10 @@ static int adjust_target(const char *src, char **dst)
|
||||
return isdir;
|
||||
}
|
||||
|
||||
/* Actual copy loop, used by both copyfile() and fcopyfile()
|
||||
* breaks loop on error and EOF */
|
||||
/*
|
||||
* Actual copy loop, used by both copyfile() and fcopyfile() breaks loop
|
||||
* on error and EOF
|
||||
*/
|
||||
static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len)
|
||||
{
|
||||
ssize_t ret = 0, size = -1;
|
||||
@@ -89,8 +91,11 @@ static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret > 0)
|
||||
if (ret > 0) {
|
||||
if (size == -1)
|
||||
size = 0;
|
||||
size += write(out, buffer, ret);
|
||||
}
|
||||
num -= count;
|
||||
} while (num > 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user