Size 0 in copyfile copies entire file (semantics of <0 reserved)

Also updated documentation

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Claudio Matsuoka committed 2008-02-17 08:11:51 -03:00
1 parent dbb31994a0
commit d17c3160bd
2 files changed
+7 -5

No files matched your search

+2 -2
View File
@@ -71,8 +71,8 @@ void copyfile(char *src, char *dst, int size)
if ((s = open(src, O_RDONLY)) >= 0) {
if ((d = open(dst, O_WRONLY | O_CREAT, 0644)) >= 0) {
/* Size <= 0 means copy entire file */
if (size <= 0) {
/* Size == 0 means copy entire file */
if (size == 0) {
do {
if ((n = read(s, buffer, BUF_SIZE)) > 0)
write(d, buffer, n);