android/socket: Fix errno handling in rfsock_set_buffer

This commit is contained in:
Szymon Janc 2014-03-01 14:51:31 +01:00
parent 30806e2eb9
commit 0fad8a94a1

View File

@ -102,14 +102,16 @@ static int rfsock_set_buffer(struct rfcomm_sock *rfsock)
err = getsockopt(rfsock->bt_sock, SOL_SOCKET, SO_RCVBUF, &rcv, &len);
if (err < 0) {
error("getsockopt(SO_RCVBUF): %s", strerror(errno));
return -errno;
int err = -errno;
error("getsockopt(SO_RCVBUF): %s", strerror(-err));
return err;
}
err = getsockopt(rfsock->bt_sock, SOL_SOCKET, SO_SNDBUF, &snd, &len);
if (err < 0) {
error("getsockopt(SO_SNDBUF): %s", strerror(errno));
return -errno;
int err = -errno;
error("getsockopt(SO_SNDBUF): %s", strerror(-err));
return err;
}
size = MAX(rcv, snd);