1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

Fix some issues revealed by coverity

This commit is contained in:
Mike Gelfand 2015-05-09 14:09:05 +00:00
parent cdf3cf62f9
commit 4a23c94252
2 changed files with 21 additions and 12 deletions

View file

@ -137,14 +137,14 @@ set_file_for_single_pass (tr_sys_file_t handle)
#ifdef HAVE_POSIX_FADVISE #ifdef HAVE_POSIX_FADVISE
posix_fadvise (handle, 0, 0, POSIX_FADV_SEQUENTIAL); (void) posix_fadvise (handle, 0, 0, POSIX_FADV_SEQUENTIAL);
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
fcntl (handle, F_RDAHEAD, 1); (void) fcntl (handle, F_RDAHEAD, 1);
fcntl (handle, F_NOCACHE, 1); (void) fcntl (handle, F_NOCACHE, 1);
#endif #endif

View file

@ -144,28 +144,37 @@ tr_address_compare (const tr_address * a, const tr_address * b)
* TCP sockets * TCP sockets
**********************************************************************/ **********************************************************************/
int void
tr_netSetTOS (tr_socket_t s, tr_netSetTOS (tr_socket_t s,
int tos) int tos)
{ {
#ifdef IP_TOS #ifdef IP_TOS
return setsockopt (s, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof (tos)); if (setsockopt (s, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof (tos)) != -1)
return;
#else #else
return 0; (void) s;
errno = ENOSYS;
#endif #endif
tr_logAddNamedInfo ("Net", "Can't set TOS '%d': %s", tos, tr_strerror (errno));
} }
int void
tr_netSetCongestionControl (tr_socket_t s UNUSED, tr_netSetCongestionControl (tr_socket_t s,
const char * algorithm UNUSED) const char * algorithm)
{ {
#ifdef TCP_CONGESTION #ifdef TCP_CONGESTION
return setsockopt (s, IPPROTO_TCP, TCP_CONGESTION, if (setsockopt (s, IPPROTO_TCP, TCP_CONGESTION,
(const void *) algorithm, strlen (algorithm) + 1); (const void *) algorithm, strlen (algorithm) + 1) != -1)
return;
#else #else
(void) s;
errno = ENOSYS; errno = ENOSYS;
return -1;
#endif #endif
tr_logAddNamedInfo ("Net", "Can't set congestion control algorithm '%s': %s",
algorithm, tr_strerror (errno));
} }
bool bool