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.5-4-gc12da2b


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.5-4-gc12da2b
Date: Thu, 02 Feb 2012 02:00:41 +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=c12da2be81d5a77040f2e75a2a0646837b29c4f5

The branch, stable-2.0 has been updated
       via  c12da2be81d5a77040f2e75a2a0646837b29c4f5 (commit)
      from  52de2ab45ab77ca5a2d6443278c7f654cdc60fb2 (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 c12da2be81d5a77040f2e75a2a0646837b29c4f5
Author: Mark H Weaver <address@hidden>
Date:   Wed Feb 1 16:35:32 2012 -0500

    Fix search_path to fill stat_buf when given an absolute pathname
    
    * libguile/load.c (search_path): When the provided 'filename' is an
      absolute pathname, perform a 'stat' on that pathname to fill the
      'stat_buf'.  Previously, 'stat_buf' was left uninitialized in this
      case, even though 'scm_primitive_load_path' assumes that 'stat_buf'
      will be filled.  Update the header comment to explicitly specify that
      'stat_buf' will be filled.  Also 'goto end' in a few failure cases
      instead of replicating its code.

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

Summary of changes:
 libguile/load.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libguile/load.c b/libguile/load.c
index 0076218..74eab19 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006, 2008, 2009, 2010, 
2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2008,
+ *   2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -419,8 +420,9 @@ scm_c_string_has_an_ext (char *str, size_t len, SCM 
extensions)
 
 /* Search PATH for a directory containing a file named FILENAME.
    The file must be readable, and not a directory.
-   If we find one, return its full filename; otherwise, return #f.
+   If we find one, return its full pathname; otherwise, return #f.
    If FILENAME is absolute, return it unchanged.
+   We also fill *stat_buf corresponding to the returned pathname.
    If given, EXTENSIONS is a list of strings; for each directory 
    in PATH, we search for FILENAME concatenated with each EXTENSION.  */
 static SCM
@@ -445,7 +447,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM 
require_exts,
   filename_len = strlen (filename_chars);
   scm_dynwind_free (filename_chars);
 
-  /* If FILENAME is absolute, return it unchanged.  */
+  /* If FILENAME is absolute and is still valid, return it unchanged.  */
 #ifdef __MINGW32__
   if (((filename_len >= 1) && 
        (filename_chars[0] == '/' || filename_chars[0] == '\\')) ||
@@ -457,14 +459,13 @@ search_path (SCM path, SCM filename, SCM extensions, SCM 
require_exts,
   if (filename_len >= 1 && filename_chars[0] == '/')
 #endif
     {
-      SCM res = filename;
-      if (scm_is_true (require_exts) &&
-          !scm_c_string_has_an_ext (filename_chars, filename_len,
+      if ((scm_is_false (require_exts) ||
+           scm_c_string_has_an_ext (filename_chars, filename_len,
                                     extensions))
-        res = SCM_BOOL_F;
-
-      scm_dynwind_end ();
-      return res;
+          && stat (filename_chars, stat_buf) == 0
+          && !(stat_buf->st_mode & S_IFDIR))
+        result = filename;
+      goto end;
     }
 
   /* If FILENAME has an extension, don't try to add EXTENSIONS to it.  */
@@ -483,8 +484,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM 
require_exts,
               {
                 /* This filename has an extension, but not one of the right
                    ones... */
-                scm_dynwind_end ();
-                return SCM_BOOL_F;
+                goto end;
               }
            /* This filename already has an extension, so cancel the
                list of extensions.  */


hooks/post-receive
-- 
GNU Guile



reply via email to

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