guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-110-g21354


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-110-g213544e
Date: Sat, 07 Jan 2012 01:12:57 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=213544e0dccb67339b009fbd7640ff9b48ca33f6

The branch, stable-2.0 has been updated
       via  213544e0dccb67339b009fbd7640ff9b48ca33f6 (commit)
      from  ab66fb3cd1d6e4343741ccb406e17eb3314eba84 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 213544e0dccb67339b009fbd7640ff9b48ca33f6
Author: Andy Wingo <address@hidden>
Date:   Sat Jan 7 02:07:09 2012 +0100

    don't leak file descriptors when mmaping objcode
    
    * libguile/objcodes.c (make_objcode_from_file): Close the mmap'd file,
      so that we don't leak the descriptor.  I was previously under the
      mistaken impression that closing the fd unmapped the memory, which is
      not the case.  Thanks to Cedric Cellier for the tip!

-----------------------------------------------------------------------

Summary of changes:
 libguile/objcodes.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index 536094f..004dd61 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -145,7 +145,7 @@ verify_cookie (char *cookie, struct stat *st, int map_fd, 
void *map_addr)
      - scm_tc7_objcode | type | flags
      - the struct scm_objcode C object
      - the parent of this objcode: either another objcode, a bytevector,
-       or, in the case of mmap types, file descriptors (as an inum)
+       or, in the case of mmap types, #f
      - "native code" -- not currently used.
  */
 
@@ -203,12 +203,11 @@ make_objcode_from_file (int fd)
                                     scm_from_size_t (total_len)));
       }
 
-    /* FIXME: we leak ourselves and the file descriptor. but then again so does
-       dlopen(). */
+    (void) close (fd);
     return scm_permanent_object
       (scm_double_cell (SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_MMAP, 0),
                         (scm_t_bits)(addr + strlen (SCM_OBJCODE_COOKIE)),
-                        SCM_UNPACK (scm_from_int (fd)), 0));
+                        SCM_BOOL_F_BITS, 0));
   }
 #else
   {


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]