Thu Sep 20 16:59:36 CEST 2007 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Thu, 20 Sep 2007 14:50:39 +0000 (14:50 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Thu, 20 Sep 2007 14:50:39 +0000 (14:50 -0000)
* image.c, metadata-internals.h: don't keep a file descriptor open
for loaded assemblies (bug#325988).

svn path=/trunk/mono/; revision=86062

mono/metadata/ChangeLog
mono/metadata/image.c
mono/metadata/metadata-internals.h

index fc4537b57ccd91c8d1564dbc6fa8b175cd64bd32..47532c6a57b08dce32085a96b14edf6bada45c91 100644 (file)
@@ -1,3 +1,9 @@
+
+Thu Sep 20 16:59:36 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+       * image.c, metadata-internals.h: don't keep a file descriptor open
+       for loaded assemblies (bug#325988).
+
 2007-09-19  Raja R Harinath  <rharinath@novell.com>
 
        * metadata.c (signature_in_image): New.  Carve out of type_in_image.
index 61c9e312550cc4a9ab477854815e36ebc87b8a3b..d84070b37e8a7550866e7f585fc269f1090c5fa3 100644 (file)
@@ -912,7 +912,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
                return NULL;
        }
        image = g_new0 (MonoImage, 1);
-       image->file_descr = filed;
+       image->raw_buffer_used = TRUE;
        image->raw_data_len = stat_buf.st_size;
        image->raw_data = mono_raw_buffer_load (fileno (filed), FALSE, 0, stat_buf.st_size);
        iinfo = g_new0 (MonoCLIImageInfo, 1);
@@ -921,6 +921,8 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
        image->ref_only = refonly;
        image->ref_count = 1;
 
+       fclose (filed);
+
        return do_mono_image_load (image, status, care_about_cli);
 }
 
@@ -1222,9 +1224,7 @@ mono_image_close (MonoImage *image)
 
        mono_images_unlock ();
 
-       if (image->file_descr) {
-               fclose (image->file_descr);
-               image->file_descr = NULL;
+       if (image->raw_buffer_used) {
                if (image->raw_data != NULL)
                        mono_raw_buffer_free (image->raw_data);
        }
index 000d226da5f9984ea3af82a5cb87fa780c90cabb..62896aed5b4f5294e5525c52c73a5e8cbeb592c4 100644 (file)
@@ -72,10 +72,9 @@ struct _MonoImage {
         * this image between calls of mono_image_open () and mono_image_close ().
         */
        int   ref_count;
-       FILE *file_descr;
-       /* if file_descr is NULL the image was loaded from raw data */
        char *raw_data;
        guint32 raw_data_len;
+       guint8 raw_buffer_used    : 1;
        guint8 raw_data_allocated : 1;
 
        /* Whenever this is a dynamically emitted module */