It is more portable to assume that SO_RCVBUF/SO_SNDBUF takes and int instead of a size_t

Signed-off-by: Lennart Poettering <lennart@poettering.net>
This commit is contained in:
Jared D. McNeill 2009-01-22 01:55:21 +01:00 committed by Lennart Poettering
parent 8d89ccdcf2
commit ca6b79141b

View file

@ -202,9 +202,11 @@ void pa_make_udp_socket_low_delay(int fd) {
}
int pa_socket_set_rcvbuf(int fd, size_t l) {
int bufsz = (int)l;
pa_assert(fd >= 0);
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&l, sizeof(l)) < 0) {
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&bufsz, sizeof(bufsz)) < 0) {
pa_log_warn("SO_RCVBUF: %s", pa_cstrerror(errno));
return -1;
}
@ -213,9 +215,11 @@ int pa_socket_set_rcvbuf(int fd, size_t l) {
}
int pa_socket_set_sndbuf(int fd, size_t l) {
int bufsz = (int)l;
pa_assert(fd >= 0);
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&l, sizeof(l)) < 0) {
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&bufsz, sizeof(bufsz)) < 0) {
pa_log("SO_SNDBUF: %s", pa_cstrerror(errno));
return -1;
}