[libgdata] Properly catch splice errors when uploading PicasaWeb files



commit 15b567f35c5886301d5a07119bbb30b464ba2fc1
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Nov 17 12:54:41 2009 +0000

    Properly catch splice errors when uploading PicasaWeb files
    
    Use a known-existing child error instead of a potentially NULL passed-in
    error to detect whether splicing on upload failed.

 gdata/services/picasaweb/gdata-picasaweb-service.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdata/services/picasaweb/gdata-picasaweb-service.c b/gdata/services/picasaweb/gdata-picasaweb-service.c
index 7b29311..180f2e2 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-service.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-service.c
@@ -329,6 +329,7 @@ gdata_picasaweb_service_upload_file (GDataPicasaWebService *self, GDataPicasaWeb
 	gchar *upload_uri;
 	gssize response_length;
 	GFileInfo *file_info = NULL;
+	GError *child_error = NULL;
 
 	g_return_val_if_fail (GDATA_IS_PICASAWEB_SERVICE (self), NULL);
 	g_return_val_if_fail (GDATA_IS_PICASAWEB_FILE (file_entry), NULL);
@@ -379,11 +380,12 @@ gdata_picasaweb_service_upload_file (GDataPicasaWebService *self, GDataPicasaWeb
 	}
 
 	g_output_stream_splice (output_stream, input_stream, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
-				cancellable, error);
+				cancellable, &child_error);
 
 	g_object_unref (input_stream);
-	if (error != NULL && *error != NULL) {
+	if (child_error != NULL) {
 		/* Error! */
+		g_propagate_error (error, child_error);
 		g_object_unref (output_stream);
 		return NULL;
 	}



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