[glib] Correct the error handling in splice_stream_with_progress



commit 6e77ee097100dc3fd695a6dad8811253cea23436
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 26 09:01:48 2010 -0400

    Correct the error handling in splice_stream_with_progress
    
    We need to get out of both loops, so a simple 'break' doesn't cut it.
    Bugs 613748 and 613923

 gio/gfile.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index fe8f4ed..b694ef3 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -2826,10 +2826,10 @@ splice_stream_with_progress (GInputStream           *in,
       while (n_read > 0)
         {
           if (g_cancellable_set_error_if_cancelled (cancellable, error))
-            break;
+            goto out;
 
           if (!do_splice (buffer[0], NULL, fd_out, &offset_out, n_read, &n_written, error))
-            break;
+            goto out;
 
           n_read -= n_written;
         }
@@ -2842,6 +2842,7 @@ splice_stream_with_progress (GInputStream           *in,
   if (progress_callback)
     progress_callback (offset_in, total_size, progress_callback_data);
 
+ out:
   close (buffer[0]);
   close (buffer[1]);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]