diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-10 05:43:11 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-10 05:43:11 +0000 |
commit | 1b26801391ff8981c211d55f462cf6a6294a8ed8 (patch) | |
tree | 1bc2cc7879ba9d87bfd40514aec4d3d93e231086 | |
parent | 557ed575e8f209487e245851b6841ecc74970291 (diff) | |
download | coreutils-1b26801391ff8981c211d55f462cf6a6294a8ed8.tar.xz |
Sync with gnulib.
-rw-r--r-- | lib/ChangeLog | 11 | ||||
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/getpass.c | 4 | ||||
-rw-r--r-- | lib/getpass.h | 31 | ||||
-rw-r--r-- | lib/obstack.c | 11 | ||||
-rw-r--r-- | lib/obstack.h | 10 | ||||
-rw-r--r-- | m4/ChangeLog | 5 | ||||
-rw-r--r-- | m4/fnmatch.m4 | 8 | ||||
-rw-r--r-- | m4/getpass.m4 | 4 |
9 files changed, 75 insertions, 10 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index a4cb4918d..62987b82e 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,16 @@ 2004-08-09 Paul Eggert <eggert@cs.ucla.edu> + * Makefile.am (libfetish_a_SOURCES): Add getpass.h. + * getpass.h: New file. + * .cpp-disable: Add it. + * getpass.c [!_LIBC]: Include it. + + * obstack.h (obstack_empty_p): + Don't assume that chunk->contents is suitably aligned. + * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk): + Likewise. Problem reported by Benno in + <http://sources.redhat.com/ml/libc-alpha/2004-08/msg00055.html>. + * chown.c (rpl_chown): Work even if the file is writeable but not readable. This could be improved further but it'd take some work. * fts.c (diropen): New function. diff --git a/lib/Makefile.am b/lib/Makefile.am index ec6f4645b..386194c65 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -66,6 +66,7 @@ libfetish_a_SOURCES = \ full-write.c full-write.h \ getline.h \ getpagesize.h \ + getpass.h \ gettime.c \ gettext.h \ getugroups.c \ diff --git a/lib/getpass.c b/lib/getpass.c index 8a993d3e0..9ac01f227 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -19,6 +19,10 @@ # include <config.h> #endif +#if !_LIBC +# include "getpass.h" +#endif + #if _LIBC # define HAVE_STDIO_EXT_H 1 #endif diff --git a/lib/getpass.h b/lib/getpass.h new file mode 100644 index 000000000..dec2a36e3 --- /dev/null +++ b/lib/getpass.h @@ -0,0 +1,31 @@ +/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin. + Copyright (C) 2004 Free Software Foundation, Inc. + Contributed by Simon Josefsson <jas@extundo.com>, 2004. + + 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. */ + +#ifndef GETPASS_H +# define GETPASS_H + +/* Get getpass declaration, if available. */ +# include <unistd.h> + +# if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS +/* Read a password of arbitrary length from /dev/tty or stdin. */ +char *getpass (const char *prompt); + +# endif + +#endif /* GETPASS_H */ diff --git a/lib/obstack.c b/lib/obstack.c index 52946d26d..8ce49ad8c 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -173,7 +173,8 @@ _obstack_begin (struct obstack *h, chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -220,7 +221,8 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment, chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); if (!chunk) (*obstack_alloc_failed_handler) (); - h->next_free = h->object_base = chunk->contents; + h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents, + alignment - 1); h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; @@ -287,7 +289,10 @@ _obstack_newchunk (struct obstack *h, int length) /* If the object just copied was the only data in OLD_CHUNK, free that chunk and remove it from the chain. But not if that chunk might contain an empty object. */ - if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + if (! h->maybe_empty_object + && (h->object_base + == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents, + h->alignment_mask))) { new_chunk->prev = old_chunk->prev; CALL_FREEFUN (h, old_chunk); diff --git a/lib/obstack.h b/lib/obstack.h index d46b0544a..46a1cb781 100644 --- a/lib/obstack.h +++ b/lib/obstack.h @@ -287,7 +287,10 @@ __extension__ \ # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ - (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ @@ -411,7 +414,10 @@ __extension__ \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ - ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions diff --git a/m4/ChangeLog b/m4/ChangeLog index 2bf789cf1..b367e1ebd 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -3,6 +3,11 @@ * sha1.m4: Renamed from sha.m4. (gl_SHA1): Renamed from gl_SHA. All uses changed. +2004-08-08 Simon Josefsson <jas@extundo.com> + + * getpass.m4 (gl_FUNC_GETPASS, gl_FUNC_GETPASS_GNU): + Check getpass declaration. + 2004-08-07 Paul Eggert <eggert@cs.ucla.edu> * canonicalize.m4, getcwd-path-max.m4, strdup.m4: Merge from gnulib. diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index ab7765b42..f96ecc171 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -28,10 +28,10 @@ AC_DEFUN([_AC_FUNC_FNMATCH_IF], [AC_CACHE_CHECK( [for working $1 fnmatch], [$2], - [# Some versions of Solaris, SCO, and the GNU C Library - # have a broken or incompatible fnmatch. - # So we run a test program. If we are cross-compiling, take no chance. - # Thanks to John Oleynick, François Pinard, and Paul Eggert for this test. + [dnl Some versions of Solaris, SCO, and the GNU C Library + dnl have a broken or incompatible fnmatch. + dnl So we run a test program. If we are cross-compiling, take no chance. + dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this test. AC_RUN_IFELSE( [AC_LANG_PROGRAM( [ diff --git a/m4/getpass.m4 b/m4/getpass.m4 index 4449bc5fb..0c4d8050f 100644 --- a/m4/getpass.m4 +++ b/m4/getpass.m4 @@ -1,4 +1,4 @@ -# getpass.m4 serial 3 +# getpass.m4 serial 4 dnl Copyright (C) 2002-2003 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 @@ -10,6 +10,7 @@ dnl the same distribution terms as the rest of that program. AC_DEFUN([gl_FUNC_GETPASS], [ AC_REPLACE_FUNCS(getpass) + AC_CHECK_DECLS_ONCE(getpass) if test $ac_cv_func_getpass = no; then gl_PREREQ_GETPASS fi @@ -19,6 +20,7 @@ AC_DEFUN([gl_FUNC_GETPASS], # arbitrary length (not just 8 bytes as on HP-UX). AC_DEFUN([gl_FUNC_GETPASS_GNU], [ + AC_CHECK_DECLS_ONCE(getpass) dnl TODO: Detect when GNU getpass() is already found in glibc. AC_LIBOBJ(getpass) gl_PREREQ_GETPASS |