CVS update: /ccvs/lib/
[email protected] 3 May 2005 14:59:37 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dprice Date: 05/05/03 07:59:37 Added: /ccvs/lib/ dup-safer.c, fd-safer.c, unistd-safer.h Modified: /ccvs/lib/ ChangeLog, Makefile.gnulib, Makefile.in, chdir-long.c, nanosleep.c, save-cwd.c, tempname.c Log: Update from GNULIB. * chdir-long.c, nanosleep.c, save-cwd.c, tempname.c: Updated. * dup-safer.c, fd-safer.c, unistd-safer.h: New files. File Changes: Directory: /ccvs/lib/ ===================== File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/ChangeLog?r1=1.415&r2=1.416 Delta lines: +6 -0 ------------------- --- ChangeLog 2 May 2005 07:24:29 -0000 1.415 +++ ChangeLog 3 May 2005 14:59:34 -0000 1.416 @@ -1,3 +1,9 @@ +2005-05-03 Derek Price <[email protected]> + + Update from GNULIB. + * chdir-long.c, nanosleep.c, save-cwd.c, tempname.c: Updated. + * dup-safer.c, fd-safer.c, unistd-safer.h: New files. + 2005-05-01 Mark D. Baushke <[email protected]> * regex.c: Update from GNULIB. File [changed]: Makefile.gnulib Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/Makefile.gnulib?r1=1.49&r2=1.50 Delta lines: +1 -1 ------------------- --- Makefile.gnulib 25 Apr 2005 20:29:14 -0000 1.49 +++ Makefile.gnulib 3 May 2005 14:59:34 -0000 1.50 @@ -9,7 +9,7 @@ # # Generated by gnulib-tool. # Invoked as: gnulib-tool --import gettext vasnprintf regex atexit save-cwd dirname error exit exitfail extensions fnmatch-posix fnmatch mkstemp getopt stdbool getline getnline getndelim2 gethostname strcase getpass-gnu gettimeofday timespec gettime unlocked-io tzset restrict time_r mktime minmax memmove nanosleep stat lstat strerror vasprintf malloc realloc strftime xsize getpagesize md5 stdint yesno allocsa setenv getdate readlink xreadlink xgethostname mkdir rename dup2 strstr ftruncate strtoul pathmax xalloc-die pagealign_alloc closeout -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --aux-dir=build-aux alloca alloca-opt allocsa atexit chdir-long closeout dirname dup2 error exit exitfail extensions fnmatch fnmatch-posix fpending ftruncate getcwd getdate gethostname getline getndelim2 getnline getopt getpagesize getpass-gnu gettext gettime gettimeofday lstat malloc md5 memmove mempcpy memrchr minmax mkdir mkstemp mktime nanosleep openat pagealign_alloc pathmax quotearg readlink realloc regex rename restrict rpmatch save-cwd setenv stat stat-macros stdbool stdint strcase strerror strftime strstr strtol strtoul time_r timespec tzset unlocked-io vasnprintf vasprintf xalloc xalloc-die xgetcwd xgethostname xreadlink xsize yesno +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --aux-dir=build-aux alloca alloca-opt allocsa atexit chdir-long closeout dirname dup2 error exit exitfail extensions fnmatch fnmatch-posix fpending ftruncate getcwd getdate gethostname getline getndelim2 getnline getopt getpagesize getpass-gnu gettext gettime gettimeofday lstat malloc md5 memmove mempcpy memrchr minmax mkdir mkstemp mktime nanosleep openat pagealign_alloc pathmax quotearg readlink realloc regex rename restrict rpmatch save-cwd setenv stat stat-macros stdbool stdint strcase strerror strftime strstr strtol strtoul time_r timespec tzset unistd-safer unlocked-io vasnprintf vasprintf xalloc xalloc-die xgetcwd xgethostname xreadlink xsize yesno AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies File [changed]: Makefile.in Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/Makefile.in?r1=1.176&r2=1.177 Delta lines: +19 -15 --------------------- --- Makefile.in 15 Apr 2005 21:12:33 -0000 1.176 +++ Makefile.in 3 May 2005 14:59:34 -0000 1.177 @@ -60,21 +60,22 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ ChangeLog __fpending.c __fpending.h alloca.c asnprintf.c \ asprintf.c atexit.c chdir-long.c chdir-long.h closeout.c \ - closeout.h dirname.c dirname.h dup2.c exitfail.c exitfail.h \ - fncase.c fnmatch.c fseeko.c ftello.c ftruncate.c getcwd.c \ - getcwd.h getdate.c getdate.h getdate.y gethostname.c getline.c \ - getline.h getndelim2.c getopt.c getopt1.c getpagesize.h \ - getpass.c getpass.h gettime.c gettimeofday.c lstat.c malloc.c \ - md5.c md5.h memmove.c mempcpy.c mempcpy.h memrchr.c memrchr.h \ - mkdir.c mkstemp.c mktime.c nanosleep.c openat.c openat.h \ - pagealign_alloc.c pagealign_alloc.h pathmax.h printf-args.c \ - printf-parse.c quotearg.c quotearg.h readlink.c realloc.c \ - regex.c rename.c rpmatch.c save-cwd.c save-cwd.h setenv.c \ - stat-macros.h stat.c strcasecmp.c strerror.c strftime.c \ - strftime.h strncasecmp.c strstr.c strtol.c strtoul.c \ - sunos57-select.c tempname.c time_r.c timespec.h unlocked-io.h \ - unsetenv.c vasnprintf.c vasprintf.c waitpid.c xalloc.h \ - xmalloc.c yesno.c yesno.h + closeout.h dirname.c dirname.h dup-safer.c dup2.c exitfail.c \ + exitfail.h fd-safer.c fncase.c fnmatch.c fseeko.c ftello.c \ + ftruncate.c getcwd.c getcwd.h getdate.c getdate.h getdate.y \ + gethostname.c getline.c getline.h getndelim2.c getopt.c \ + getopt1.c getpagesize.h getpass.c getpass.h gettime.c \ + gettimeofday.c lstat.c malloc.c md5.c md5.h memmove.c \ + mempcpy.c mempcpy.h memrchr.c memrchr.h mkdir.c mkstemp.c \ + mktime.c nanosleep.c openat.c openat.h pagealign_alloc.c \ + pagealign_alloc.h pathmax.h printf-args.c printf-parse.c \ + quotearg.c quotearg.h readlink.c realloc.c regex.c rename.c \ + rpmatch.c save-cwd.c save-cwd.h setenv.c stat-macros.h stat.c \ + strcasecmp.c strerror.c strftime.c strftime.h strncasecmp.c \ + strstr.c strtol.c strtoul.c sunos57-select.c tempname.c \ + time_r.c timespec.h unistd-safer.h unlocked-io.h unsetenv.c \ + vasnprintf.c vasprintf.c waitpid.c xalloc.h xmalloc.c yesno.c \ + yesno.h ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_extract_cpp_defn.m4 \ $(top_srcdir)/m4/acx_with_external_zlib.m4 \ @@ -128,6 +129,7 @@ $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ $(top_srcdir)/m4/tzset.m4 $(top_srcdir)/m4/uint32_t.m4 \ $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -401,8 +403,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/chdir-long.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/closeout.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dirname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dup-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dup2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/exitfail.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fd-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fncase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fnmatch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fseeko.Po@am__quote@ File [changed]: chdir-long.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/chdir-long.c?r1=1.1&r2=1.2 Delta lines: +1 -1 ------------------- --- chdir-long.c 1 Mar 2005 18:15:42 -0000 1.1 +++ chdir-long.c 3 May 2005 14:59:34 -0000 1.2 @@ -269,6 +269,6 @@ /* Local Variables: -compile-command: "gcc -DTEST_CHDIR=1 -DHAVE_CONFIG_H -I.. -g -O -W -Wall chdir-long.c libfetish.a" +compile-command: "gcc -DTEST_CHDIR=1 -DHAVE_CONFIG_H -I.. -g -O -W -Wall chdir-long.c libcoreutils.a" End: */ File [added]: dup-safer.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/dup-safer.c?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 50 --------------- /* Invoke dup, but avoid some glitches. Copyright (C) 2001, 2004, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Eggert. */ #if HAVE_CONFIG_H # include <config.h> #endif #include "unistd-safer.h" #if HAVE_FCNTL_H # include <fcntl.h> #endif #if HAVE_UNISTD_H # include <unistd.h> #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ int dup_safer (int fd) { #ifdef F_DUPFD return fcntl (fd, F_DUPFD, STDERR_FILENO + 1); #else /* fd_safer calls us back, but eventually the recursion unwinds and does the right thing. */ return fd_safer (dup (fd)); #endif } File [added]: fd-safer.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/fd-safer.c?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 61 --------------- /* Return a safer copy of a file descriptor. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Eggert. */ #if HAVE_CONFIG_H # include <config.h> #endif #include "unistd-safer.h" #include <errno.h> #if HAVE_UNISTD_H # include <unistd.h> #endif #ifndef STDIN_FILENO # define STDIN_FILENO 0 #endif #ifndef STDERR_FILENO # define STDERR_FILENO 2 #endif /* Return FD, unless FD would be a copy of standard input, output, or error; in that case, return a duplicate of FD, closing FD. On failure to duplicate, close FD, set errno, and return -1. Preserve errno if FD is negative, so that the caller can always inspect errno when the returned value is negative. This function is usefully wrapped around functions that return file descriptors, e.g., fd_safer (open ("file", O_RDONLY)). */ int fd_safer (int fd) { if (STDIN_FILENO <= fd && fd <= STDERR_FILENO) { int f = dup_safer (fd); int e = errno; close (fd); errno = e; fd = f; } return fd; } File [changed]: nanosleep.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/nanosleep.c?r1=1.3&r2=1.4 Delta lines: +14 -10 --------------------- --- nanosleep.c 10 Oct 2004 03:43:27 -0000 1.3 +++ nanosleep.c 3 May 2005 14:59:34 -0000 1.4 @@ -1,5 +1,5 @@ /* Provide a replacement for the POSIX nanosleep function. - Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2004, 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 @@ -34,6 +34,8 @@ # include <unistd.h> #endif +#include "timespec.h" + /* Some systems (MSDOS) don't have SIGCONT. Using SIGTERM here turns the signal-handling code below into a no-op on such systems. */ @@ -41,7 +43,9 @@ # define SIGCONT SIGTERM #endif -#include "timespec.h" +#if ! HAVE_SIGINTERRUPT +# define siginterrupt(sig, flag) /* empty */ +#endif static sig_atomic_t volatile suspended; @@ -66,7 +70,7 @@ tv_delay.tv_sec++; tv_delay.tv_usec = 0; } - select (0, (void *) 0, (void *) 0, (void *) 0, &tv_delay); + select (0, NULL, NULL, NULL, &tv_delay); } /* FIXME: comment */ @@ -77,16 +81,11 @@ { static bool initialized; -#ifdef SA_NOCLDSTOP - struct sigaction oldact, newact; -#endif - - suspended = 0; - /* set up sig handler */ if (! initialized) { #ifdef SA_NOCLDSTOP + struct sigaction oldact, newact; newact.sa_handler = sighandler; sigemptyset (&newact.sa_mask); newact.sa_flags = 0; @@ -96,11 +95,16 @@ sigaction (SIGCONT, &newact, NULL); #else if (signal (SIGCONT, SIG_IGN) != SIG_IGN) + { signal (SIGCONT, sighandler); + siginterrupt (SIGCONT, 1); + } #endif initialized = true; } + suspended = 0; + my_usleep (requested_delay); if (suspended) File [changed]: save-cwd.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/save-cwd.c?r1=1.7&r2=1.8 Delta lines: +4 -3 ------------------- --- save-cwd.c 10 Mar 2005 16:29:15 -0000 1.7 +++ save-cwd.c 3 May 2005 14:59:34 -0000 1.8 @@ -42,6 +42,7 @@ #include <errno.h> #include "chdir-long.h" +#include "unistd-safer.h" #include "xgetcwd.h" /* On systems without the fchdir function (WOE), pretend that open @@ -49,7 +50,7 @@ Since chdir_long requires fchdir, use chdir instead. */ #if !HAVE_FCHDIR # undef open -# define open(File, Flags) -1 +# define open(File, Flags) (-1) # undef fchdir # define fchdir(Fd) (abort (), -1) # undef chdir_long @@ -81,10 +82,10 @@ { cwd->name = NULL; - cwd->desc = open (".", O_RDONLY); + cwd->desc = fd_safer (open (".", O_RDONLY)); if (cwd->desc < 0) { - cwd->desc = open (".", O_WRONLY); + cwd->desc = fd_safer (open (".", O_WRONLY)); if (cwd->desc < 0) { cwd->name = xgetcwd (); File [changed]: tempname.c Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/tempname.c?r1=1.2&r2=1.3 Delta lines: +2 -25 -------------------- --- tempname.c 6 Oct 2004 18:09:22 -0000 1.2 +++ tempname.c 3 May 2005 14:59:34 -0000 1.3 @@ -1,7 +1,7 @@ /* tempname.c - generate the name of a temporary file. Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 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 @@ -67,34 +67,11 @@ #endif #include <sys/stat.h> -#if STAT_MACROS_BROKEN -# undef S_ISDIR -#endif -#if !defined S_ISDIR && defined S_IFDIR -# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif #if _LIBC # define struct_stat64 struct stat64 #else +# include "stat-macros.h" # define struct_stat64 struct stat # define __getpid getpid # define __gettimeofday gettimeofday File [added]: unistd-safer.h Url: https://ccvs.cvshome.org/source/browse/ccvs/lib/unistd-safer.h?rev=1.1&content-type=text/vnd.viewcvs-markup Added lines: 22 --------------- /* Invoke unistd-like functions, but avoid some glitches. Copyright (C) 2001, 2003, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Paul Eggert. */ int dup_safer (int); int fd_safer (int);