cvsuser     05/02/05 01:40:42

  Modified:    src      library.c
  Log:
  [perl #34051] [PATCH] return absolute paths from Parrot_locate_runtime_file
  
  Parrot_readbc can segfault when loading an absolute path to a file (in my
  case, only under GDB).  the problem lies in Parrot_locate_runtime_file,
  and is similar to the one in ticket #32087.
  
  the attached patch adds a check in Parrot_locate_runtime_file so it
  returns absolute paths as is.  it handles win32 paths (and drive letters)
  as well.  hopefully i chose the most logical place for this -- i didn't
  think it belonged in Parrot_readbc itself.
  
  Courtesy of Jeff Horwitz <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.15      +15 -1     parrot/src/library.c
  
  Index: library.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/library.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- library.c 16 Dec 2004 10:37:16 -0000      1.14
  +++ library.c 5 Feb 2005 09:40:42 -0000       1.15
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  -$Id: library.c,v 1.14 2004/12/16 10:37:16 leo Exp $
  +$Id: library.c,v 1.15 2005/02/05 09:40:42 leo Exp $
   
   =head1 NAME
   
  @@ -199,6 +199,20 @@
       if (!ext) {
           internal_exception(UNIMPLEMENTED, "no extension: file '%s'", 
file_name);
       }
  +
  +    /* use absolute paths as is */
  +#ifdef WIN32
  +    if (file_name[0] == '\\' || (isalpha(file_name[0]) &&
  +                strncmp(file_name+1, ":\\", 2) == 0)) {
  +#else
  +    if (file_name[0] == '/') {
  +#endif
  +        length = strlen(file_name) + 1;
  +        full_name = mem_sys_allocate(length);
  +        strcpy(full_name, file_name);
  +        return full_name;
  +    }
  +
       length = 0;
       for (ptr = paths; *ptr; ++ptr) {
           int len = strlen(*ptr);
  
  
  

Reply via email to