From a6d4bd35fc45e87e21d227dcfba24216569be250 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Tue, 29 Dec 2015 00:42:40 +0000 Subject: [PATCH] Get rid of some more warnings --- daemon/daemon-posix.c | 5 +++-- libtransmission/torrent.c | 3 ++- libtransmission/tr-lpd.c | 3 ++- libtransmission/utils.c | 2 +- libtransmission/utils.h | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/daemon/daemon-posix.c b/daemon/daemon-posix.c index 834b6ce99..fdae6dd95 100644 --- a/daemon/daemon-posix.c +++ b/daemon/daemon-posix.c @@ -11,7 +11,7 @@ #include #include #include -#include /* daemon (), exit () */ +#include /* abort (), daemon (), exit () */ #include /* open () */ #include /* fork (), setsid (), chdir (), dup2 (), close (), pipe () */ @@ -70,7 +70,8 @@ send_signal_to_pipe (int sig) { const int old_errno = errno; - write (signal_pipe[1], &sig, sizeof (sig)); + if (write (signal_pipe[1], &sig, sizeof (sig)) == -1) + abort (); errno = old_errno; } diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index b2837a417..6770b7a03 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -2178,7 +2178,8 @@ torrentCallScript (const tr_torrent * tor, const char * script) for (i = 0; env[i] != NULL; ++i) putenv (env[i]); - (void) chdir ("/"); + if (chdir ("/") == -1) + /* ignore (nice to have but not that critical) */; if (execvp (script, cmd) == -1) tr_logAddTorErr (tor, "error executing script \"%s\": %s", script, tr_strerror (errno)); diff --git a/libtransmission/tr-lpd.c b/libtransmission/tr-lpd.c index 09733f42c..ba6a38741 100644 --- a/libtransmission/tr-lpd.c +++ b/libtransmission/tr-lpd.c @@ -404,7 +404,8 @@ tr_lpdEnabled (const tr_session* ss) * @remark Declared inline for the compiler not to allege us of feeding unused * functions. In any other respect, lpd_consistencyCheck is an orphaned function. */ -static inline void lpd_consistencyCheck (void) +UNUSED static inline void +lpd_consistencyCheck (void) { /* if the following check fails, the definition of a hash string has changed * without our knowledge; revise string handling in functions tr_lpdSendAnnounce diff --git a/libtransmission/utils.c b/libtransmission/utils.c index ea3b75a5a..b08f4fb40 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -812,7 +812,7 @@ tr_urlParse (const char * url, const char * host_end = memchr (authority, ':', authority_len); - const size_t host_len = host_end != NULL ? host_end - authority : authority_len; + const size_t host_len = host_end != NULL ? (size_t) (host_end - authority) : authority_len; if (host_len == 0) return false; diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 1fe5c4c79..13b34dc15 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -360,10 +360,10 @@ void tr_hex_to_binary (const char * input, void * output, size_t byte_length) TR bool tr_addressIsIP (const char * address); /** @brief return true if the url is a http or https or UDP url that Transmission understands */ -bool tr_urlIsValidTracker (const char * url) TR_GNUC_NONNULL (1); +bool tr_urlIsValidTracker (const char * url); /** @brief return true if the url is a [ http, https, ftp, sftp ] url that Transmission understands */ -bool tr_urlIsValid (const char * url, size_t url_len) TR_GNUC_NONNULL (1); +bool tr_urlIsValid (const char * url, size_t url_len); /** @brief parse a URL into its component parts @return True on success or false if an error occurred */