mirror of
https://github.com/troglobit/libite.git
synced 2026-11-07 16:01:01 +00:00
Fix copyfile() regression introduced in 4e9b5c13
Caught in release cycle. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e44aaa4fd5
commit
ac7b4194cf
1 file changed
+8
-3
+8
-3
@@ -71,8 +71,10 @@ static int adjust_target(const char *src, char **dst)
|
|||||||
return isdir;
|
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)
|
static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0, size = -1;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0) {
|
||||||
|
if (size == -1)
|
||||||
|
size = 0;
|
||||||
size += write(out, buffer, ret);
|
size += write(out, buffer, ret);
|
||||||
|
}
|
||||||
num -= count;
|
num -= count;
|
||||||
} while (num > 0);
|
} while (num > 0);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user