Mercurial > hg > octave-lyh > gnulib-hg
changeset 7409:830788a4cbd4
[lib/ChangeLog]
Fix some Darwin-7.9.0 porting problems reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00063.html>.
* dirchownmod.c: Include lchown.h.
* lchown.c: Don't include files that lchown.h now includes.
Don't declare chown, since lchown.h now does that.
* lchown.h: Include errno.h, sys/types.h, unistd.h.
(lchown): Define to rpl_chown if lchown is declared but
does not exist. Declare using a prototype if lchown is not
declared. Add a copyright notice.
* mkstemp.h: Include <unistd.h>.
* openat.c: Include lchown.h.
[m4/ChangeLog]
* lchown.m4 (gl_FUNC_LCHOWN): Check whether lchown is declared.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 05 Oct 2006 22:49:57 +0000 |
parents | e23b1333a117 |
children | 9704ff2cbdfe |
files | lib/ChangeLog lib/dirchownmod.c lib/lchown.c lib/lchown.h lib/mkstemp.h lib/openat.c m4/ChangeLog m4/lchown.m4 |
diffstat | 8 files changed, 53 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,17 @@ 2006-10-05 Paul Eggert <eggert@cs.ucla.edu> + Fix some Darwin-7.9.0 porting problems reported by Bruno Haible in + <http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00063.html>. + * dirchownmod.c: Include lchown.h. + * lchown.c: Don't include files that lchown.h now includes. + Don't declare chown, since lchown.h now does that. + * lchown.h: Include errno.h, sys/types.h, unistd.h. + (lchown): Define to rpl_chown if lchown is declared but + does not exist. Declare using a prototype if lchown is not + declared. Add a copyright notice. + * mkstemp.h: Include <unistd.h>. + * openat.c: Include lchown.h. + * fcntl_.h (O_NOFOLLOW): Don't depend on O_NOFOLLOW_IS_INEFFECTIVE; we now test for that separately. * fts.c (fts_safe_changedir): Inspect HAVE_WORKING_O_NOFOLLOW
--- a/lib/dirchownmod.c +++ b/lib/dirchownmod.c @@ -28,6 +28,7 @@ #include <unistd.h> #include "lchmod.h" +#include "lchown.h" #include "stat-macros.h" #ifndef HAVE_FCHMOD
--- a/lib/lchown.c +++ b/lib/lchown.c @@ -21,17 +21,10 @@ #include <config.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> +#include "lchown.h" -#include "lchown.h" #include "stat-macros.h" -/* Declare chown to avoid a warning. Don't include unistd.h, - because it may have a conflicting prototype for lchown. */ -int chown (); - /* Work just like chown, except when FILE is a symbolic link. In that case, set errno to EOPNOTSUPP and return -1. But if autoconf tests determined that chown modifies
--- a/lib/lchown.h +++ b/lib/lchown.h @@ -1,3 +1,36 @@ +/* Declare a replacement for lchown on hosts that lack it. + + Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Jim Meyering. */ + +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> + +#if HAVE_DECL_LCHOWN +# if ! HAVE_LCHOWN +# undef lchown +# define lchown rpl_chown +# endif +#else +int lchown (char const *, uid_t, gid_t); +#endif + /* Some systems don't have EOPNOTSUPP. */ #ifndef EOPNOTSUPP # ifdef ENOTSUP
--- a/lib/mkstemp.h +++ b/lib/mkstemp.h @@ -19,6 +19,7 @@ /* written by Jim Meyering */ #include <stdlib.h> +#include <unistd.h> #ifdef __MKSTEMP_PREFIX # define _GL_CONCAT(x, y) x ## y
--- a/lib/openat.c +++ b/lib/openat.c @@ -26,6 +26,7 @@ #include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ #include "fcntl--.h" +#include "lchown.h" #include "lstat.h" #include "openat-priv.h" #include "save-cwd.h"
--- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,5 +1,7 @@ 2006-10-05 Paul Eggert <eggert@cs.ucla.edu> + * lchown.m4 (gl_FUNC_LCHOWN): Check whether lchown is declared. + * fcntl_h.m4 (gl_FCNTL_H): Define HAVE_WORKING_O_NOFOLLOW instead of O_NOFOLLOW_IS_INEFFECTIVE. Define HAVE_WORKING_O_NOATIME if O_NOATIME works.
--- a/m4/lchown.m4 +++ b/m4/lchown.m4 @@ -1,4 +1,4 @@ -#serial 9 +#serial 10 dnl Copyright (C) 1998, 2001, 2003, 2004, 2005, 2006 Free Software dnl Foundation, Inc. @@ -15,5 +15,6 @@ AC_REQUIRE([AC_TYPE_UID_T]) AC_REQUIRE([gl_FUNC_CHOWN]) AC_REQUIRE([gl_STAT_MACROS]) + AC_CHECK_DECLS_ONCE([lchown]) AC_REPLACE_FUNCS(lchown) ])