[shotwell] Do not close FileDescriptor passed to CameraFile



commit 208bc88a17d7524905cb8bf465d9f5ba64e073bd
Author: Jens Georg <mail jensge org>
Date:   Thu Aug 10 19:18:10 2017 +0200

    Do not close FileDescriptor passed to CameraFile
    
    CameraFile takes ownership of the file descriptor and closes it, so we
    end up closing random file descriptors.
    
    Big thanks to Stefan for debugging this
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785503

 src/camera/GPhoto.vala |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
---
diff --git a/src/camera/GPhoto.vala b/src/camera/GPhoto.vala
index 3d327df..a3c225a 100644
--- a/src/camera/GPhoto.vala
+++ b/src/camera/GPhoto.vala
@@ -228,18 +228,14 @@ namespace GPhoto {
         GPhoto.CameraFile camera_file;
         GPhoto.Result res = GPhoto.CameraFile.create_from_fd(out camera_file, fd);
         if (res != Result.OK) {
-            Posix.close(fd);
             throw new GPhotoError.LIBRARY("[%d] Error allocating camera file: %s", (int) res, 
res.as_string());
         }
         
         res = camera.get_file(folder, filename, GPhoto.CameraFileType.NORMAL, camera_file, context);
         if (res != Result.OK) {
-            Posix.close(fd);
             throw new GPhotoError.LIBRARY("[%d] Error retrieving file object for %s/%s: %s", 
                 (int) res, folder, filename, res.as_string());
         }
-
-        Posix.close(fd);
     }
     
     public PhotoMetadata? load_metadata(Context context, Camera camera, string folder, string filename)


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