bug-gnulib
[Top][All Lists]
Advanced

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

module 'fts-lgpl' not complete


From: Bruno Haible
Subject: module 'fts-lgpl' not complete
Date: Wed, 25 Jan 2006 15:58:56 +0100
User-agent: KMail/1.5.4

Hi,

Building the module 'fts-lgpl' on Linux/glibc fails like this:

gcc -DHAVE_CONFIG_H -I. -I/packages/megatestdir/fts-lgpl/lib -I..     -g -O2 -c 
/packages/megatestdir/fts-lgpl/lib/fts.c
/packages/megatestdir/fts-lgpl/lib/fts.c:75:20: lstat.h: No such file or 
directory

The reason is that the 'lstat' module is GPL.

Jim, would you agree to put the 'lstat' module under LGPL if we cut its
dependency from the 'xalloc' module? Actually, using allocsa instead of
xmalloc will also speed it up. What do you think about these two alternative
patches?

Bruno


*** lstat.c     2005-09-21 13:08:21.000000000 +0200
--- lstat.c.1   2006-01-08 18:38:41.000000000 +0100
***************
*** 1,6 ****
  /* Work around a bug of lstat on some systems
  
!    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
     Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
--- 1,6 ----
  /* Work around a bug of lstat on some systems
  
!    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 
Free
     Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 30,40 ****
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <stdlib.h>
  #include <string.h>
  
  #include "stat-macros.h"
- #include "xalloc.h"
  
  /* lstat works differently on Linux and Solaris systems.  POSIX (see
     `pathname resolution' in the glossary) requires that programs like `ls'
--- 30,41 ----
  
  #include <sys/types.h>
  #include <sys/stat.h>
+ #include <errno.h>
  #include <stdlib.h>
  #include <string.h>
  
+ #include "allocsa.h"
  #include "stat-macros.h"
  
  /* lstat works differently on Linux and Solaris systems.  POSIX (see
     `pathname resolution' in the glossary) requires that programs like `ls'
***************
*** 65,77 ****
       Append a `.' to FILE and repeat the lstat call.  */
  
    /* Add one for the `.' we'll append, and one more for the trailing NUL.  */
!   new_file = xmalloc (len + 1 + 1);
    memcpy (new_file, file, len);
    new_file[len] = '.';
    new_file[len + 1] = 0;
  
    lstat_result = lstat (new_file, sbuf);
!   free (new_file);
  
    return lstat_result;
  }
--- 66,83 ----
       Append a `.' to FILE and repeat the lstat call.  */
  
    /* Add one for the `.' we'll append, and one more for the trailing NUL.  */
!   new_file = allocsa (len + 1 + 1);
!   if (new_file == NULL)
!     {
!       errno = ENOMEM;
!       return -1;
!     }
    memcpy (new_file, file, len);
    new_file[len] = '.';
    new_file[len + 1] = 0;
  
    lstat_result = lstat (new_file, sbuf);
!   freesa (new_file);
  
    return lstat_result;
  }
*** lstat.c     2005-09-21 13:08:21.000000000 +0200
--- lstat.c.2   2006-01-08 18:38:41.000000000 +0100
***************
*** 1,6 ****
  /* Work around a bug of lstat on some systems
  
!    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
     Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
--- 1,6 ----
  /* Work around a bug of lstat on some systems
  
!    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 
Free
     Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 44,50 ****
     `lstat("symlink/.",sbuf)', but on Solaris it does not.
  
     If FILE has a trailing slash and specifies a symbolic link,
!    then append a `.' to FILE and call lstat a second time.  */
  
  int
  rpl_lstat (const char *file, struct stat *sbuf)
--- 44,50 ----
     `lstat("symlink/.",sbuf)', but on Solaris it does not.
  
     If FILE has a trailing slash and specifies a symbolic link,
!    then call stat instead.  */
  
  int
  rpl_lstat (const char *file, struct stat *sbuf)
***************
*** 62,77 ****
      return lstat_result;
  
    /* FILE refers to a symbolic link and the name ends with a slash.
!      Append a `.' to FILE and repeat the lstat call.  */
  
!   /* Add one for the `.' we'll append, and one more for the trailing NUL.  */
!   new_file = xmalloc (len + 1 + 1);
!   memcpy (new_file, file, len);
!   new_file[len] = '.';
!   new_file[len + 1] = 0;
! 
!   lstat_result = lstat (new_file, sbuf);
!   free (new_file);
! 
!   return lstat_result;
  }
--- 62,68 ----
      return lstat_result;
  
    /* FILE refers to a symbolic link and the name ends with a slash.
!      Call stat() to get info about the link's destination.  */
  
!   return stat (file, sbuf);
  }






reply via email to

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