From: Ralf Habacker Date: Tue, 3 Mar 2015 13:15:51 +0000 (+0100) Subject: Fix warning 'conversion to ‘long unsigned int’ from ‘WriteResult’ may change the... X-Git-Tag: dbus-1.9.16~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6588c65708d7f64bb3547f75689f105efadd58e3;p=thirdparty%2Fdbus.git Fix warning 'conversion to ‘long unsigned int’ from ‘WriteResult’ may change the sign of the result [-Wsign-conversion]'. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie --- diff --git a/tools/tool-common.c b/tools/tool-common.c index 497a50978..b1f365029 100644 --- a/tools/tool-common.c +++ b/tools/tool-common.c @@ -80,18 +80,21 @@ tool_write_all (int fd, while (size > bytes_written) { - WriteResult this_time = write (fd, p, size - bytes_written); + WriteResult res = write (fd, p, size - bytes_written); - if (this_time < 0) + if (res < 0) { if (errno == EINTR) continue; else return FALSE; } - - p += this_time; - bytes_written += this_time; + else + { + size_t this_time = (size_t) res; + p += this_time; + bytes_written += this_time; + } } return TRUE;