Eric Blake <[EMAIL PROTECTED]> wrote: > Jim Meyering <jim <at> meyering.net> writes: >> I've just checked in these changes: >> >> 2005-08-14 Jim Meyering <jim <at> meyering.net> >> Sync from coreutils. ... > This patch breaks fts, as used by CVS findutils, because fcntl--.h is not part > of a gnulib module yet. > > gcc -DHAVE_CONFIG_H -I. -I. -I../.. -g -O2 -c fts.c > fts.c:151:22: fcntl--.h: No such file or directory
Thanks for reporting that. With the following changes, ./gnulib-tool --test fts once again passes. I'll hold off on the commit until Paul signs off on it. 2005-08-24 Jim Meyering <[EMAIL PROTECTED]> * modules/fcntl-safer: New module. * modules/fts (Depends-on): Add fcntl-safer. * MODULES.html.sh (File descriptor based Input/Output): Add fcntl-safer. m4: 2005-08-24 Jim Meyering <[EMAIL PROTECTED]> Sync from coreutils. * fcntl-safer.m4: New file. lib: 2005-08-24 Jim Meyering <[EMAIL PROTECTED]> Sync from coreutils. * fcntl--.h, fcntl-safer.h, open-safer.c: New files. Index: lib/fcntl--.h =================================================================== RCS file: lib/fcntl--.h diff -N lib/fcntl--.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/fcntl--.h 24 Aug 2005 10:29:53 -0000 @@ -0,0 +1,25 @@ +/* Like fcntl.h, but redefine some names to avoid glitches. + + Copyright (C) 2005 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 Paul Eggert. */ + +#include <fcntl.h> +#include "fcntl-safer.h" + +#undef open +#define open open_safer Index: lib/fcntl-safer.h =================================================================== RCS file: lib/fcntl-safer.h diff -N lib/fcntl-safer.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/fcntl-safer.h 24 Aug 2005 10:29:53 -0000 @@ -0,0 +1,21 @@ +/* Invoke fcntl-like functions, but avoid some glitches. + + Copyright (C) 2005 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 Paul Eggert. */ + +int open_safer (char const *, int, ...); Index: lib/open-safer.c =================================================================== RCS file: lib/open-safer.c diff -N lib/open-safer.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/open-safer.c 24 Aug 2005 10:29:53 -0000 @@ -0,0 +1,47 @@ +/* Invoke open, but avoid some glitches. + Copyright (C) 2005 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 Paul Eggert. */ + +#include "fcntl-safer.h" + +#include <fcntl.h> +#include <stdarg.h> +#include "unistd-safer.h" + +int +open_safer (char const *file, int flags, ...) +{ + mode_t mode = 0; + + if (flags & O_CREAT) + { + va_list ap; + va_start (ap, flags); + + /* Assume mode_t promotes to int if and only if it is smaller. + This assumption isn't guaranteed by the C standard, but we + don't know of any real-world counterexamples. */ + mode = (sizeof (mode_t) < sizeof (int) + ? va_arg (ap, int) + : va_arg (ap, mode_t)); + + va_end (ap); + } + + return fd_safer (open (file, flags, mode)); +} Index: m4/fcntl-safer.m4 =================================================================== RCS file: m4/fcntl-safer.m4 diff -N m4/fcntl-safer.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ m4/fcntl-safer.m4 24 Aug 2005 10:29:53 -0000 @@ -0,0 +1,11 @@ +# fcntl-safer.m4 serial 1 +dnl Copyright (C) 2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FCNTL_SAFER], +[ + AC_LIBSOURCES([open-safer.c, fcntl-safer.h, fcntl--.h]) + AC_LIBOBJ([open-safer]) +]) Index: modules/fcntl-safer =================================================================== RCS file: modules/fcntl-safer diff -N modules/fcntl-safer --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/fcntl-safer 24 Aug 2005 10:29:53 -0000 @@ -0,0 +1,25 @@ +Description: +File descriptor functions that avoid clobbering STD{IN,OUT,ERR}_FILENO. + +Files: +lib/fcntl--.h +lib/open-safer.c +lib/fcntl-safer.h +m4/fcntl-safer.m4 + +Depends-on: +unistd-safer + +configure.ac: +gl_FCNTL_SAFER + +Makefile.am: + +Include: +"fcntl-safer.h" + +License: +GPL + +Maintainer: +Paul Eggert, Jim Meyering Index: modules/fts =================================================================== RCS file: /cvsroot/gnulib/gnulib/modules/fts,v retrieving revision 1.3 diff -u -p -r1.3 fts --- modules/fts 27 May 2005 23:59:21 -0000 1.3 +++ modules/fts 24 Aug 2005 10:29:53 -0000 @@ -13,7 +13,7 @@ dirfd hash lstat stdbool -unistd-safer +fcntl-safer configure.ac: gl_FUNC_FTS Index: MODULES.html.sh =================================================================== RCS file: /cvsroot/gnulib/gnulib/MODULES.html.sh,v retrieving revision 1.104 diff -u -p -r1.104 MODULES.html.sh --- MODULES.html.sh 17 Aug 2005 14:09:19 -0000 1.104 +++ MODULES.html.sh 24 Aug 2005 11:32:39 -0000 @@ -1863,6 +1863,7 @@ func_all_modules () func_echo "$element" func_begin_table + func_module fcntl-safer func_module safe-read func_module safe-write func_module full-read _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib