Changeset 14527


Ignore:
Timestamp:
May 9, 2015, 2:09:05 PM (6 years ago)
Author:
mikedld
Message:

Fix some issues revealed by coverity

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/file-posix.c

    r14493 r14527  
    138138#ifdef HAVE_POSIX_FADVISE
    139139
    140   posix_fadvise (handle, 0, 0, POSIX_FADV_SEQUENTIAL);
     140  (void) posix_fadvise (handle, 0, 0, POSIX_FADV_SEQUENTIAL);
    141141
    142142#endif
     
    144144#ifdef __APPLE__
    145145
    146   fcntl (handle, F_RDAHEAD, 1);
    147   fcntl (handle, F_NOCACHE, 1);
     146  (void) fcntl (handle, F_RDAHEAD, 1);
     147  (void) fcntl (handle, F_NOCACHE, 1);
    148148
    149149#endif
  • trunk/libtransmission/net.c

    r14482 r14527  
    145145 **********************************************************************/
    146146
    147 int
     147void
    148148tr_netSetTOS (tr_socket_t s,
    149149              int         tos)
    150150{
    151151#ifdef IP_TOS
    152     return setsockopt (s, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof (tos));
     152    if (setsockopt (s, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof (tos)) != -1)
     153        return;
    153154#else
    154     return 0;
    155 #endif
    156 }
    157 
    158 int
    159 tr_netSetCongestionControl (tr_socket_t   s UNUSED,
    160                             const char  * algorithm UNUSED)
     155    (void) s;
     156    errno = ENOSYS;
     157#endif
     158
     159    tr_logAddNamedInfo ("Net", "Can't set TOS '%d': %s", tos, tr_strerror (errno));
     160}
     161
     162void
     163tr_netSetCongestionControl (tr_socket_t   s,
     164                            const char  * algorithm)
    161165{
    162166#ifdef TCP_CONGESTION
    163     return setsockopt (s, IPPROTO_TCP, TCP_CONGESTION,
    164                        (const void *) algorithm, strlen (algorithm) + 1);
     167    if (setsockopt (s, IPPROTO_TCP, TCP_CONGESTION,
     168                    (const void *) algorithm, strlen (algorithm) + 1) != -1)
     169        return;
     170
    165171#else
     172    (void) s;
    166173    errno = ENOSYS;
    167     return -1;
    168 #endif
     174#endif
     175
     176    tr_logAddNamedInfo ("Net", "Can't set congestion control algorithm '%s': %s",
     177                        algorithm, tr_strerror (errno));
    169178}
    170179
Note: See TracChangeset for help on using the changeset viewer.