return true;
// Load the local file description
- lseek (pack->handle, pfile->offset, SEEK_SET);
+ if (lseek (pack->handle, pfile->offset, SEEK_SET) == -1)
+ {
+ Con_Printf ("Can't seek in package %s\n", pack->filename);
+ return false;
+ }
count = read (pack->handle, buffer, ZIP_LOCAL_CHUNK_BASE_SIZE);
if (count != ZIP_LOCAL_CHUNK_BASE_SIZE || BuffBigLong (buffer) != ZIP_DATA_HEADER)
{
namelen = sizeof(localaddress->addr.in6);
bindresult = bind(lhnetsocket->inetsocket, &localaddress->addr.sock, namelen);
if (bindresult != -1)
- getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen);
+ {
+ if (getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen))
+ {
+ // If getsockname failed, we can assume the bound socket is useless.
+ bindresult = -1;
+ }
+ }
}
else
#endif
namelen = sizeof(localaddress->addr.in);
bindresult = bind(lhnetsocket->inetsocket, &localaddress->addr.sock, namelen);
if (bindresult != -1)
- getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen);
+ {
+ if (getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen))
+ {
+ // If getsockname failed, we can assume the bound socket is useless.
+ bindresult = -1;
+ }
+ }
}
if (bindresult != -1)
{
{
// enable DSCP for ToS support
int tos = lhnet_default_dscp << 2;
- setsockopt(lhnetsocket->inetsocket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos));
+ if (setsockopt(lhnetsocket->inetsocket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos)))
+ {
+ // Error in setsockopt - fine, we'll simply set no TOS then.
+ }
}
#endif
lhnetsocket->next = &lhnet_socketlist;