diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 62d1275433184e40bfc88b10e4b2f4a4a80f1fc9..c208f1d8f12aa300308e6dbe7b2aa0399dc3de14 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -1117,13 +1117,14 @@ thunar_g_file_compare_contents (GFile        *file_a,
     {
       for (;;)
         {
-          gssize bytes_read_a = g_input_stream_read (G_INPUT_STREAM (inp_a), buf_a, buf_size, cancellable, error);
-          if (bytes_read_a < 0)
+          gsize bytes_read_a;
+          gsize bytes_read_b;
+
+          if (!g_input_stream_read_all (G_INPUT_STREAM (inp_a), buf_a, buf_size, &bytes_read_a, cancellable, error))
             {
               break;
             }
-          gssize bytes_read_b = g_input_stream_read (G_INPUT_STREAM (inp_b), buf_b, buf_size, cancellable, error);
-          if (bytes_read_b < 0)
+          if (!g_input_stream_read_all (G_INPUT_STREAM (inp_b), buf_b, buf_size, &bytes_read_b, cancellable, error))
             {
               break;
             }