Propagate error codes in FIONREAD. Fixes bug #3973.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30896 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-05-28 16:03:50 +00:00
parent 607254f510
commit f54023cf37

View File

@ -502,6 +502,9 @@ socket_control(net_socket* socket, int32 op, void* data, size_t length)
return B_BAD_VALUE;
ssize_t available = socket_read_avail(socket);
if (available < B_OK)
return available;
if (is_syscall()) {
if (!IS_USER_ADDRESS(data)
|| user_memcpy(data, &available, sizeof(ssize_t)) != B_OK) {