summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/tool-common.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/tool-common.c b/tools/tool-common.c
index 497a5097..b1f36502 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;