X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Fnet.c;h=e0d12af3ba3fb9e098921907bc65731f104090e6;hb=a0633ee8aa6dd5b72541735f3cc47c5c30b783eb;hp=ea80a6af9c5d8c46ea1812716b0e2ab55a2f96ae;hpb=b4d16e90e02d270d685aecf5cf2499d34483ab92;p=doldaconnect.git diff --git a/daemon/net.c b/daemon/net.c index ea80a6a..e0d12af 100644 --- a/daemon/net.c +++ b/daemon/net.c @@ -1,6 +1,6 @@ /* * Dolda Connect - Modular multiuser Direct Connect-style client - * Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com) + * Copyright (C) 2004 Fredrik Tolf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -388,12 +388,17 @@ static void sockrecv(struct socket *sk) #if defined(HAVE_LINUX_SOCKIOS_H) && defined(SIOCINQ) /* SIOCINQ is Linux-specific AFAIK, but I really have no idea * how to read the inqueue size on other OSs */ - if(ioctl(sk->fd, SIOCINQ, &inq)) - { - /* I don't really know what could go wrong here, so let's - * assume it's transient. */ - flog(LOG_WARNING, "SIOCINQ return %s on socket %i, falling back to 2048 bytes", strerror(errno), sk->fd); - inq = 2048; + if(sk->isrealsocket) { + if(ioctl(sk->fd, SIOCINQ, &inq)) + { + /* I don't really know what could go wrong here, so let's + * assume it's transient. */ + flog(LOG_WARNING, "SIOCINQ return %s on socket %i, falling back to 2048 bytes", strerror(errno), sk->fd); + inq = 2048; + } + } else { + /* There are perils when trying to use SIOCINQ on files >2GiB... */ + inq = 65536; } #else inq = 2048; @@ -549,7 +554,7 @@ void closesock(struct socket *sk) { struct sockaddr_un *un; - if((sk->family == AF_UNIX) && !sockgetlocalname(sk, (struct sockaddr **)&un, NULL) && (un->sun_family == PF_UNIX)) + if((sk->family == AF_UNIX) && !sockgetlocalname(sk, (struct sockaddr **)(void *)&un, NULL) && (un->sun_family == PF_UNIX)) { if((sk->state == SOCK_LST) && strchr(un->sun_path, '/')) {