improve error handling for copy_attributes :
if nothing is read or an error happens on read, continue with next attribute, same for write. Also, use actual written byte count for looping. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -164,15 +164,15 @@ copy_attributes(int fromFd, int toFd)
|
||||
ssize_t bytesRead, bytesWritten;
|
||||
|
||||
bytesRead = fs_read_attr(fromFd, dirent->d_name, info.type, pos, buffer, sizeof(buffer));
|
||||
if (bytesRead < 0)
|
||||
continue;
|
||||
if (bytesRead <= 0)
|
||||
break;
|
||||
|
||||
bytesWritten = fs_write_attr(toFd, dirent->d_name, info.type, pos, buffer, bytesRead);
|
||||
if (bytesWritten != bytesRead)
|
||||
continue;
|
||||
if (bytesWritten <= 0)
|
||||
break;
|
||||
|
||||
pos += bytesRead;
|
||||
info.size -= bytesRead;
|
||||
pos += bytesWritten;
|
||||
info.size -= bytesWritten;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user