Mercurial > hg > octave-kai > gnulib-hg
changeset 5078:146129232fe0
Merge from coreutils CVS.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 01 Jun 2004 20:27:08 +0000 |
parents | b21574f3020f |
children | 16347793332c |
files | ChangeLog lib/.cppi-disable lib/.cvsignore lib/ChangeLog lib/chown.c lib/file-type.c lib/file-type.h lib/lchown.c lib/stat-macros.h lib/xreadlink.c lib/xreadlink.h m4/ChangeLog m4/backupfile.m4 m4/chown.m4 m4/dirname.m4 m4/human.m4 m4/inttypes.m4 m4/longlong.m4 m4/makepath.m4 m4/memchr.m4 m4/memcmp.m4 m4/mountlist.m4 m4/path-concat.m4 m4/prereq.m4 m4/putenv.m4 m4/quotearg.m4 m4/readutmp.m4 m4/strtoimax.m4 m4/strtoll.m4 m4/strtoull.m4 m4/strtoumax.m4 m4/ulonglong.m4 m4/vasnprintf.m4 m4/xstrtol.m4 modules/file-type |
diffstat | 35 files changed, 453 insertions(+), 185 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-06-01 Paul Eggert <eggert@cs.ucla.edu> + + * modules/file-type: Add lib/stat-macros.h. + 2004-05-30 Paul Eggert <eggert@cs.ucla.edu> * modules/hash (Depends-on): Remove malloc, realloc.
--- a/lib/.cppi-disable +++ b/lib/.cppi-disable @@ -1,9 +1,15 @@ +alloca_.h +allocsa.h error.h +exit.h fnmatch.h +getndelim2.h getopt.c getopt.h getopt1.c getpagesize.h +gettext.h +localcharset.h md5.h obstack.h printf-args.h @@ -11,5 +17,9 @@ regex.c regex.h stdbool_.h +strdup.h +strndup.h +strtoul.c +time_r.h vasnprintf.h vasprintf.h
--- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -1,9 +1,12 @@ .deps Makefile +alloca.h charset.alias getdate.c getdate.tab.c +fnmatch.h lstat.c +poll.h ref-add.sed ref-del.sed safe-lstat.c @@ -11,4 +14,6 @@ safe-stat.c safe-stat.h stat.c +stdbool.h +sysexit.h unlocked-io.h
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,31 @@ +2004-06-01 Paul Eggert <eggert@cs.ucla.edu> + and Jim Meyering <jim@meyering.net> + + Merge from coreutils CVS. + + * stat-macros.h: New file, with contents from file-type.h + and coreutils' system.h. + * file-type.c: Include "stat-macros.h". + * file-type.h (file_type): Move all macro definitions to new file, + stat-macros.h. + + * chown.c (rpl_chown) [CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE]: + Wrap old code with this conditional. + [CHOWN_MODIFIES_SYMLINK]: Try to work around a chown + function that does not dereference symlinks. + * lchown.c (lchown) [CHOWN_MODIFIES_SYMLINK]: Just call chown. + + * xreadlink.c: Include xreadlink.h first, to catch .h file + dependency problems. + (xreadlink): Accept new arg SIZE, for efficiency. + All decls and uses changed. + * xreadlink.h: Include <stddef.h>, for size_t. + + * .cppi-disable: Add alloca_.h, allocsa.h, exit.h, getndelim2.h, + gettext.h, localcharset.h, strdup.h, strndup.h, strtoul.c, time_r.h. + + * .cvsignore: Add alloca.h, fnmatch.h, poll.h, stdbool.h, sysexits.h. + 2004-05-30 Paul Eggert <eggert@cs.ucla.edu> * xmalloc.c (HAVE_MALLOC, HAVE_REALLOC): Do not require these
--- a/lib/chown.c +++ b/lib/chown.c @@ -1,6 +1,6 @@ /* provide consistent interface to chown for systems that don't interpret an ID of -1 as meaning `don't change the corresponding ID'. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,12 +30,26 @@ #if HAVE_UNISTD_H # include <unistd.h> #endif +#if HAVE_FCNTL_H +# include <fcntl.h> +#else +# include <sys/file.h> +#endif +#include <errno.h> +#ifndef errno +extern int errno; +#endif -/* FIXME: describe. */ +/* Provide a more-closely POSIX-conforming version of chown on + systems with one or both of the following problems: + - chown doesn't treat an ID of -1 as meaning + `don't change the corresponding ID'. + - chown doesn't dereference symlinks. */ int rpl_chown (const char *file, uid_t uid, gid_t gid) { +#if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE if (gid == (gid_t) -1 || uid == (uid_t) -1) { struct stat file_stats; @@ -50,6 +64,28 @@ if (uid == (uid_t) -1) uid = file_stats.st_uid; } +#endif +#if CHOWN_MODIFIES_SYMLINK + { + /* Handle the case in which the system-supplied chown function + does *not* follow symlinks. Instead, it changes permissions + on the symlink itself. To work around that, we open the + file (but this can fail due to lack of read permission) and + use fchown on the resulting descriptor. */ + int fd = open (file, O_RDONLY | O_NONBLOCK | O_NOCTTY); + if (fd == -1) + return -1; + if (fchown (fd, uid, gid)) + { + int saved_errno = errno; + close (fd); + errno = saved_errno; + return -1; + } + return close (fd); + } +#else return chown (file, uid, gid); +#endif }
--- a/lib/file-type.c +++ b/lib/file-type.c @@ -25,6 +25,7 @@ #include <sys/types.h> #include <sys/stat.h> #include "file-type.h" +#include "stat-macros.h" #include <gettext.h> #define _(text) gettext (text)
--- a/lib/file-type.h +++ b/lib/file-type.h @@ -21,146 +21,6 @@ #ifndef FILE_TYPE_H # define FILE_TYPE_H 1 -# if ! defined S_ISREG && ! defined S_IFREG -you must include <sys/stat.h> before including this file -# endif - char const *file_type (struct stat const *); -# ifndef S_IFMT -# define S_IFMT 0170000 -# endif - -# if STAT_MACROS_BROKEN -# undef S_ISBLK -# undef S_ISCHR -# undef S_ISDIR -# undef S_ISDOOR -# undef S_ISFIFO -# undef S_ISLNK -# undef S_ISNAM -# undef S_ISMPB -# undef S_ISMPC -# undef S_ISNWK -# undef S_ISREG -# undef S_ISSOCK -# endif - - -# ifndef S_ISBLK -# ifdef S_IFBLK -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -# else -# define S_ISBLK(m) 0 -# endif -# endif - -# ifndef S_ISCHR -# ifdef S_IFCHR -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -# else -# define S_ISCHR(m) 0 -# endif -# endif - -# ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(m) 0 -# endif -# endif - -# ifndef S_ISDOOR /* Solaris 2.5 and up */ -# ifdef S_IFDOOR -# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR) -# else -# define S_ISDOOR(m) 0 -# endif -# endif - -# ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -# endif - -# ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(m) 0 -# endif -# endif - -# ifndef S_ISMPB /* V7 */ -# ifdef S_IFMPB -# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -# else -# define S_ISMPB(m) 0 -# define S_ISMPC(m) 0 -# endif -# endif - -# ifndef S_ISNAM /* Xenix */ -# ifdef S_IFNAM -# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -# else -# define S_ISNAM(m) 0 -# endif -# endif - -# ifndef S_ISNWK /* HP/UX */ -# ifdef S_IFNWK -# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -# else -# define S_ISNWK(m) 0 -# endif -# endif - -# ifndef S_ISREG -# ifdef S_IFREG -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -# else -# define S_ISREG(m) 0 -# endif -# endif - -# ifndef S_ISSOCK -# ifdef S_IFSOCK -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -# else -# define S_ISSOCK(m) 0 -# endif -# endif - - -# ifndef S_TYPEISMQ -# define S_TYPEISMQ(p) 0 -# endif - -# ifndef S_TYPEISTMO -# define S_TYPEISTMO(p) 0 -# endif - - -# ifndef S_TYPEISSEM -# ifdef S_INSEM -# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -# else -# define S_TYPEISSEM(p) 0 -# endif -# endif - -# ifndef S_TYPEISSHM -# ifdef S_INSHD -# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -# else -# define S_TYPEISSHM(p) 0 -# endif -# endif - #endif /* FILE_TYPE_H */
--- a/lib/lchown.c +++ b/lib/lchown.c @@ -1,5 +1,5 @@ /* Provide a stub lchown function for systems that lack it. - Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,11 +44,16 @@ int chown (); /* Work just like chown, except when FILE is a symbolic link. - In that case, set errno to ENOSYS and return -1. */ + In that case, set errno to ENOSYS and return -1. + But if autoconf tests determined that chown modifies + symlinks, then just call chown. */ int lchown (const char *file, uid_t uid, gid_t gid) { +#if CHOWN_MODIFIES_SYMLINK + return chown (file, uid, gid); +#else struct stat stats; if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode)) @@ -58,4 +63,5 @@ } return chown (file, uid, gid); +#endif }
new file mode 100644 --- /dev/null +++ b/lib/stat-macros.h @@ -0,0 +1,240 @@ +/* stat-related macros + + Copyright (C) 1993, 1994, 2001, 2002, 2004 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Written by Paul Eggert and Jim Meyering. */ + +#ifndef STAT_MACROS_H +# define STAT_MACROS_H 1 + +# if ! defined S_ISREG && ! defined S_IFREG +# error "you must include <sys/stat.h> before including this file" +# endif + +# ifndef S_IFMT +# define S_IFMT 0170000 +# endif + +# if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISDOOR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +# endif + + +# ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +# endif + +# ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +# endif + +# ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +# endif + +# ifndef S_ISDOOR /* Solaris 2.5 and up */ +# ifdef S_IFDOOR +# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR) +# else +# define S_ISDOOR(m) 0 +# endif +# endif + +# ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +# endif + +# ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +# endif + +# ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +# endif + +# ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +# endif + +# ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +# endif + +# ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +# endif + +# ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +# endif + + +# ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +# endif + +# ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +# endif + + +# ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +# endif + +# ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +# endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +# if !S_ISUID +# define S_ISUID 04000 +# endif +# if !S_ISGID +# define S_ISGID 02000 +# endif + +/* S_ISVTX is a common extension to POSIX. */ +# ifndef S_ISVTX +# define S_ISVTX 01000 +# endif + +# if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +# endif +# if !S_IRUSR +# define S_IRUSR 00400 +# endif +# if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +# endif +# if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +# endif + +# if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +# endif +# if !S_IWUSR +# define S_IWUSR 00200 +# endif +# if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +# endif +# if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +# endif + +# if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +# endif +# if !S_IXUSR +# define S_IXUSR 00100 +# endif +# if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +# endif +# if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +# endif + +# if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +# endif +# if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +# endif +# if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +# endif + +/* S_IXUGO is a common extension to POSIX. */ +# if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +# endif + +# ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +# endif + +/* All the mode bits that can be affected by chmod. */ +# define CHMOD_MODE_BITS \ + (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) + +#endif /* STAT_MACROS_H */
--- a/lib/xreadlink.c +++ b/lib/xreadlink.c @@ -1,6 +1,6 @@ /* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage - Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +23,8 @@ # include <config.h> #endif +#include "xreadlink.h" + #include <stdio.h> #include <errno.h> #ifndef errno @@ -44,20 +46,21 @@ #endif #include "xalloc.h" -#include "xreadlink.h" /* Call readlink to get the symbolic link value of FILENAME. + SIZE is a hint as to how long the link is expected to be; + typically it is taken from st_size. It need not be correct. Return a pointer to that NUL-terminated string in malloc'd storage. If readlink fails, return NULL (caller may use errno to diagnose). If malloc fails, or if the link value is longer than SSIZE_MAX :-), give a diagnostic and exit. */ char * -xreadlink (char const *filename) +xreadlink (char const *filename, size_t size) { /* The initial buffer size for the link value. A power of 2 detects arithmetic overflow earlier, but is not required. */ - size_t buf_size = 128; + size_t buf_size = size + 1; while (1) { @@ -80,7 +83,7 @@ free (buffer); buf_size *= 2; - if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0)) + if (! (0 < buf_size && buf_size <= SSIZE_MAX)) xalloc_die (); } }
--- a/lib/xreadlink.h +++ b/lib/xreadlink.h @@ -1,6 +1,6 @@ /* readlink wrapper to return the link name in malloc'd storage - Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,4 +19,5 @@ /* Written by Jim Meyering <jim@meyering.net> */ -char *xreadlink (char const *); +#include <stddef.h> +char *xreadlink (char const *, size_t);
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,22 @@ +2004-06-01 Paul Eggert <eggert@cs.ucla.edu> + + Merge from coreutils CVS. + + * backupfile.m4, dirname.m4, human.m4, inttypes.m4, longlong.m4, + makepath.m4, memchr.m4, memcmp.m4, mountlist.m4, path-concat.m4, + putenv.m4, quotearg.m4, readutmp.m4, strtoimax.m4, strtoll.m4, + strtoull.m4, strtoumax.m4, ulonglong.m4, vasnprintf.m4, + xstrtol.m4: Fix copyright date and/or serial number. + + * chown.m4 (gl_PREREQ_CHOWN): Check for fcntl.h. + See if we need an fchown replacement. + (gl_FUNC_CHOWN_FOLLOWS_SYMLINK): New macro. + (gl_FUNC_CHOWN): Require gl_FUNC_CHOWN_FOLLOWS_SYMLINK, + and use the replacement function if we detect either defect. + + * prereq.m4 (gl_PREREQ): Add gl_ALLOCSA, gl_CLOEXEC, gl_INTTOSTR, + gl_UTIMECMP. + 2004-05-31 Paul Eggert <eggert@cs.ucla.edu> * stdbool.m4 (AC_HEADER_STDBOOL): Detect _Bool bug in HP aC++/ANSI
--- a/m4/backupfile.m4 +++ b/m4/backupfile.m4 @@ -1,5 +1,5 @@ # backupfile.m4 serial 4 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/chown.m4 +++ b/m4/chown.m4 @@ -1,15 +1,24 @@ -#serial 9 - -dnl From Jim Meyering. -dnl Determine whether chown accepts arguments of -1 for uid and gid. -dnl If it doesn't, arrange to use the replacement function. -dnl +#serial 10 +# Determine whether we need the chown wrapper. chown should accept +# arguments of -1 for uid and gid, and it should dereference symlinks. +# If it doesn't, arrange to use the replacement function. +# From Jim Meyering. AC_DEFUN([gl_FUNC_CHOWN], [ - AC_REQUIRE([AC_TYPE_UID_T])dnl + AC_REQUIRE([AC_TYPE_UID_T]) AC_REQUIRE([AC_FUNC_CHOWN]) - if test $ac_cv_func_chown_works = no; then + AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK]) + + if test $ac_cv_func_chown_works = yes; then + AC_DEFINE(CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE, 1, + [Define if chown is not POSIX compliant regarding IDs of -1.]) + fi + + # If chown has either of the above problems, then we need the wrapper. + if test $ac_cv_func_chown_works$gl_cv_func_chown_follows_symlink = yesyes; then + : # no wrapper needed + else AC_LIBOBJ(chown) AC_DEFINE(chown, rpl_chown, [Define to rpl_chown if the replacement function should be used.]) @@ -17,8 +26,51 @@ fi ]) +# Determine whether chown follows symlinks (it should). +AC_DEFUN([gl_FUNC_CHOWN_FOLLOWS_SYMLINK], +[ + AC_CACHE_CHECK( + [whether chown(2) dereferences symlinks], + gl_cv_func_chown_follows_symlink, + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <stdlib.h> +#include <errno.h> + + int + main () + { + char const *dangling_symlink = "conftest.dangle"; + + unlink (dangling_symlink); + if (symlink ("conftest.no-such", dangling_symlink)) + abort (); + + /* Exit successfully on a conforming system, + i.e., where chown must fail with ENOENT. */ + exit ( ! (chown (dangling_symlink, getuid (), getgid ()) != 0 + && errno == ENOENT)); + } + ]])], + [gl_cv_func_chown_follows_symlink=yes], + [gl_cv_func_chown_follows_symlink=no], + [gl_cv_func_chown_follows_symlink=no] + ) + ] + ) + + if test $gl_cv_func_chown_follows_symlink = no; then + AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, + [Define if chown modifies symlinks.]) + fi +]) + # Prerequisites of lib/chown.c. AC_DEFUN([gl_PREREQ_CHOWN], [ - AC_CHECK_HEADERS_ONCE(unistd.h) + AC_CHECK_HEADERS_ONCE(unistd.h fcntl.h) + AC_CHECK_FUNC([fchown], , [AC_LIBOBJ(fchown-stub)]) ])
--- a/m4/dirname.m4 +++ b/m4/dirname.m4 @@ -1,5 +1,5 @@ # dirname.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/human.m4 +++ b/m4/human.m4 @@ -1,5 +1,5 @@ # human.m4 serial 5 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,5 +1,5 @@ -# inttypes.m4 serial 2 -dnl Copyright (C) 1997-2002, 2004 Free Software Foundation, Inc. +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/longlong.m4 +++ b/m4/longlong.m4 @@ -1,5 +1,5 @@ # longlong.m4 serial 5 -dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/makepath.m4 +++ b/m4/makepath.m4 @@ -1,5 +1,5 @@ # makepath.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,5 +1,5 @@ # memchr.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/memcmp.m4 +++ b/m4/memcmp.m4 @@ -1,5 +1,5 @@ # memcmp.m4 serial 10 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/mountlist.m4 +++ b/m4/mountlist.m4 @@ -1,5 +1,5 @@ # mountlist.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/path-concat.m4 +++ b/m4/path-concat.m4 @@ -1,5 +1,5 @@ # path-concat.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/prereq.m4 +++ b/m4/prereq.m4 @@ -1,4 +1,4 @@ -#serial 39 +#serial 40 dnl We use gl_ for non Autoconf macros. m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl @@ -15,8 +15,10 @@ AC_REQUIRE([AM_STDBOOL_H]) AC_REQUIRE([gl_FUNC_MKDIR_TRAILING_SLASH]) AC_REQUIRE([gl_FUNC_MKSTEMP]) + AC_REQUIRE([gl_ALLOCSA]) AC_REQUIRE([gl_BACKUPFILE]) AC_REQUIRE([gl_CANON_HOST]) + AC_REQUIRE([gl_CLOEXEC]) AC_REQUIRE([gl_CLOSEOUT]) AC_REQUIRE([gl_DIRNAME]) AC_REQUIRE([gl_ERROR]) @@ -71,6 +73,7 @@ AC_REQUIRE([gl_HASH]) AC_REQUIRE([gl_HUMAN]) AC_REQUIRE([gl_IDCACHE]) + AC_REQUIRE([gl_INTTOSTR]) AC_REQUIRE([gl_LONG_OPTIONS]) AC_REQUIRE([gl_MAKEPATH]) AC_REQUIRE([gl_MBSWIDTH]) @@ -102,6 +105,7 @@ AC_REQUIRE([gl_UNICODEIO]) AC_REQUIRE([gl_UNISTD_SAFER]) AC_REQUIRE([gl_USERSPEC]) + AC_REQUIRE([gl_UTIMECMP]) AC_REQUIRE([gl_UTIMENS]) AC_REQUIRE([gl_XALLOC]) AC_REQUIRE([gl_XGETCWD])
--- a/m4/putenv.m4 +++ b/m4/putenv.m4 @@ -1,5 +1,5 @@ # putenv.m4 serial 8 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/quotearg.m4 +++ b/m4/quotearg.m4 @@ -1,5 +1,5 @@ # quotearg.m4 serial 2 -dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/readutmp.m4 +++ b/m4/readutmp.m4 @@ -1,4 +1,4 @@ -# readutmp.m4 serial 3 +# readutmp.m4 serial 4 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General
--- a/m4/strtoimax.m4 +++ b/m4/strtoimax.m4 @@ -1,5 +1,5 @@ # strtoimax.m4 serial 4 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/strtoll.m4 +++ b/m4/strtoll.m4 @@ -1,5 +1,5 @@ # strtoll.m4 serial 2 -dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program @@ -23,4 +23,3 @@ AC_DEFUN([gl_PREREQ_STRTOLL], [ : ]) -
--- a/m4/strtoull.m4 +++ b/m4/strtoull.m4 @@ -1,5 +1,5 @@ # strtoull.m4 serial 2 -dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program @@ -23,4 +23,3 @@ AC_DEFUN([gl_PREREQ_STRTOULL], [ : ]) -
--- a/m4/strtoumax.m4 +++ b/m4/strtoumax.m4 @@ -1,5 +1,5 @@ # strtoumax.m4 serial 4 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/ulonglong.m4 +++ b/m4/ulonglong.m4 @@ -1,5 +1,5 @@ # ulonglong.m4 serial 4 -dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/vasnprintf.m4 +++ b/m4/vasnprintf.m4 @@ -1,5 +1,5 @@ # vasnprintf.m4 serial 4 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/m4/xstrtol.m4 +++ b/m4/xstrtol.m4 @@ -1,5 +1,5 @@ # xstrtol.m4 serial 4 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program
--- a/modules/file-type +++ b/modules/file-type @@ -4,6 +4,7 @@ Files: lib/file-type.h lib/file-type.c +lib/stat-macros.h m4/file-type.m4 Depends-on: @@ -13,7 +14,7 @@ gl_FILE_TYPE Makefile.am: -lib_SOURCES += file-type.h file-type.c +lib_SOURCES += file-type.h file-type.c stat-macros.h Include: "file-type.h"