[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/lib ChangeLog chdir-long.c getopt.c gettim...
From: |
Mark D. Baushke |
Subject: |
[Cvs-cvs] ccvs/lib ChangeLog chdir-long.c getopt.c gettim... |
Date: |
Wed, 25 Jan 2006 12:53:38 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Branch:
Changes by: Mark D. Baushke <address@hidden> 06/01/25 12:53:38
Modified files:
lib : ChangeLog chdir-long.c getopt.c gettime.c
glob-libc.h glob_.h md5.c md5.h openat.c
openat.h quotearg.c regex_internal.h save-cwd.c
stdbool_.h stdint_.h strftime.c vasnprintf.c
Added files:
lib : intprops.h mkdirat.c openat-priv.h socket_.h
Log message:
* doc/getdate.texi: Update from GNULIB.
* lib/chdir-long.c, lib/getopt.c, lib/gettime.c, lib/glob-libc.h,
lib/glob_.h, lib/intprops.h, lib/md5.c, lib/md5.h, lib/mkdirat.c,
lib/openat-priv.h, lib/openat.c, lib/openat.h, lib/quotearg.c,
lib/regex_internal.h, lib/save-cwd.c, lib/socket_.h, lib/stdbool_.h,
lib/stdint_.h, lib/strftime.c, lib/vasnprintf.c: Update from GNULIB.
* m4/fpending.m4, m4/getopt.m4, m4/gnulib-comp.m4, m4/openat.m4,
m4/socklen.m4, m4/stdbool.m4, m4/stdint.m4, m4/sys_socket_h.m4: Update
from GNULIB.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/ChangeLog.diff?tr1=1.489&tr2=1.490&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/chdir-long.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/getopt.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/gettime.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/glob-libc.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/glob_.h.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/intprops.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/md5.c.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/md5.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/mkdirat.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/openat-priv.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/openat.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/openat.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/quotearg.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/regex_internal.h.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/save-cwd.c.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/socket_.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/stdbool_.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/stdint_.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/strftime.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/lib/vasnprintf.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: ccvs/lib/ChangeLog
diff -u ccvs/lib/ChangeLog:1.489 ccvs/lib/ChangeLog:1.490
--- ccvs/lib/ChangeLog:1.489 Wed Dec 7 10:49:28 2005
+++ ccvs/lib/ChangeLog Wed Jan 25 12:53:38 2006
@@ -1,3 +1,11 @@
+2006-01-25 Mark D. Baushke <address@hidden>
+
+ * chdir-long.c, getopt.c, gettime.c, glob-libc.h, glob_.h,
+ intprops.h, md5.c, md5.h, mkdirat.c, openat-priv.h, openat.c,
+ openat.h, quotearg.c, regex_internal.h, save-cwd.c, socket_.h,
+ stdbool_.h, stdint_.h, strftime.c, vasnprintf.c: Update from
+ GNULIB.
+
2005-12-07 Mark D. Baushke <address@hidden>
* stdint_.h: Update from GNULIB.
Index: ccvs/lib/chdir-long.c
diff -u ccvs/lib/chdir-long.c:1.4 ccvs/lib/chdir-long.c:1.5
--- ccvs/lib/chdir-long.c:1.4 Mon Sep 19 21:26:13 2005
+++ ccvs/lib/chdir-long.c Wed Jan 25 12:53:38 2006
@@ -77,13 +77,10 @@
static int
cdb_advance_fd (struct cd_buf *cdb, char const *dir)
{
- int new_fd = openat (cdb->fd, dir, O_RDONLY | O_DIRECTORY);
+ int new_fd = openat (cdb->fd, dir,
+ O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
if (new_fd < 0)
- {
- new_fd = openat (cdb->fd, dir, O_WRONLY | O_DIRECTORY);
- if (new_fd < 0)
- return -1;
- }
+ return -1;
cdb_free (cdb);
cdb->fd = new_fd;
Index: ccvs/lib/getopt.c
diff -u ccvs/lib/getopt.c:1.9 ccvs/lib/getopt.c:1.10
--- ccvs/lib/getopt.c:1.9 Mon May 23 17:44:31 2005
+++ ccvs/lib/getopt.c Wed Jan 25 12:53:38 2006
@@ -2,7 +2,7 @@
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to address@hidden
before changing it!
- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
+ Copyright (C)
1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -20,28 +20,16 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-# define _NO_PROTO
-#endif
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <stdio.h>
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-# include <stdlib.h>
-# include <unistd.h>
-#endif /* GNU C library. */
+#include "getopt.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef VMS
# include <unixlib.h>
@@ -76,7 +64,6 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
-#include "getopt.h"
#include "getopt_int.h"
/* For communication from `getopt' to the caller.
@@ -118,16 +105,9 @@
static struct _getopt_data getopt_data;
-#ifndef __GNU_LIBRARY__
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-#ifndef getenv
+#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
extern char *getenv ();
#endif
-
-#endif /* not __GNU_LIBRARY__ */
#ifdef _LIBC
/* Stored original parameters.
@@ -556,10 +536,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -634,10 +611,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -674,10 +648,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -751,10 +722,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -817,10 +785,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -868,10 +833,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -940,10 +902,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -985,10 +944,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1027,10 +983,7 @@
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@ -1101,10 +1054,7 @@
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
Index: ccvs/lib/gettime.c
diff -u ccvs/lib/gettime.c:1.4 ccvs/lib/gettime.c:1.5
--- ccvs/lib/gettime.c:1.4 Mon May 23 17:44:31 2005
+++ ccvs/lib/gettime.c Wed Jan 25 12:53:38 2006
@@ -45,8 +45,14 @@
ts->tv_nsec = tv.tv_usec * 1000;
}
# else
+
+# ifndef OK_TO_USE_1S_CLOCK
+# error "Only 1-second nominal clock resolution found. Is that intended?" \
+ "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
+# endif
ts->tv_sec = time (NULL);
ts->tv_nsec = 0;
+
# endif
#endif
Index: ccvs/lib/glob-libc.h
diff -u ccvs/lib/glob-libc.h:1.1 ccvs/lib/glob-libc.h:1.2
--- ccvs/lib/glob-libc.h:1.1 Fri Sep 9 22:00:23 2005
+++ ccvs/lib/glob-libc.h Wed Jan 25 12:53:38 2006
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95-98,2000,2001,2004-2006 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -104,13 +104,13 @@
#else
void *(*gl_readdir) (void *);
#endif
- void *(*gl_opendir) (__const char *);
+ void *(*gl_opendir) (const char *);
#ifdef __USE_GNU
- int (*gl_lstat) (__const char *__restrict, struct stat *__restrict);
- int (*gl_stat) (__const char *__restrict, struct stat *__restrict);
+ int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
+ int (*gl_stat) (const char *__restrict, struct stat *__restrict);
#else
- int (*gl_lstat) (__const char *__restrict, void *__restrict);
- int (*gl_stat) (__const char *__restrict, void *__restrict);
+ int (*gl_lstat) (const char *__restrict, void *__restrict);
+ int (*gl_stat) (const char *__restrict, void *__restrict);
#endif
} glob_t;
@@ -133,13 +133,13 @@
# else
void *(*gl_readdir) (void *);
# endif
- void *(*gl_opendir) (__const char *);
+ void *(*gl_opendir) (const char *);
# ifdef __USE_GNU
- int (*gl_lstat) (__const char *__restrict, struct stat64 *__restrict);
- int (*gl_stat) (__const char *__restrict, struct stat64 *__restrict);
+ int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
+ int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
# else
- int (*gl_lstat) (__const char *__restrict, void *__restrict);
- int (*gl_stat) (__const char *__restrict, void *__restrict);
+ int (*gl_lstat) (const char *__restrict, void *__restrict);
+ int (*gl_stat) (const char *__restrict, void *__restrict);
# endif
} glob64_t;
#endif
@@ -158,24 +158,24 @@
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
-extern int glob (__const char *__restrict __pattern, int __flags,
- int (*__errfunc) (__const char *, int),
+extern int glob (const char *__restrict __pattern, int __flags,
+ int (*__errfunc) (const char *, int),
glob_t *__restrict __pglob) __THROW;
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree (glob_t *__pglob) __THROW;
#else
-extern int __REDIRECT_NTH (glob, (__const char *__restrict __pattern,
+extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
int __flags,
- int (*__errfunc) (__const char *, int),
+ int (*__errfunc) (const char *, int),
glob_t *__restrict __pglob), glob64);
extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
#endif
#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
-extern int glob64 (__const char *__restrict __pattern, int __flags,
- int (*__errfunc) (__const char *, int),
+extern int glob64 (const char *__restrict __pattern, int __flags,
+ int (*__errfunc) (const char *, int),
glob64_t *__restrict __pglob) __THROW;
extern void globfree64 (glob64_t *__pglob) __THROW;
@@ -188,7 +188,7 @@
This function is not part of the interface specified by POSIX.2
but several programs want to use it. */
-extern int glob_pattern_p (__const char *__pattern, int __quote) __THROW;
+extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
#endif
__END_DECLS
Index: ccvs/lib/glob_.h
diff -u ccvs/lib/glob_.h:1.16 ccvs/lib/glob_.h:1.17
--- ccvs/lib/glob_.h:1.16 Fri Sep 9 22:00:24 2005
+++ ccvs/lib/glob_.h Wed Jan 25 12:53:38 2006
@@ -1,6 +1,6 @@
/* glob_.h -- Find a path matching a pattern.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Written by Derek Price <address@hidden> & Paul Eggert <address@hidden>
@@ -38,9 +38,6 @@
#ifndef __size_t
# define __size_t size_t
#endif
-#ifndef __const
-# define __const const
-#endif
#ifndef __restrict
# define __restrict restrict
#endif
Index: ccvs/lib/md5.c
diff -u ccvs/lib/md5.c:1.13 ccvs/lib/md5.c:1.14
--- ccvs/lib/md5.c:1.13 Mon Nov 28 02:35:49 2005
+++ ccvs/lib/md5.c Wed Jan 25 12:53:38 2006
@@ -1,6 +1,6 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995,1996,1997,1999,2000,2001,2005
+ Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -86,7 +86,7 @@
must be in little endian byte order.
IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
+ aligned for a 32-bit value. */
void *
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{
@@ -102,7 +102,7 @@
prolog according to the standard and write the result to RESBUF.
IMPORTANT: On some systems it is required that RESBUF is correctly
- aligned for a 32 bits value. */
+ aligned for a 32-bit value. */
void *
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
{
@@ -245,14 +245,8 @@
if (len >= 64)
{
#if !_STRING_ARCH_unaligned
-/* To check alignment gcc has an appropriate operator. Other
- compilers don't. */
-# if __GNUC__ >= 2
-# define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint32_t) != 0)
-# else
-# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
-# endif
+# define alignof(type) offsetof (struct { char c; type x; }, x)
+# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
if (UNALIGNED_P (buffer))
while (len > 64)
{
@@ -382,7 +376,7 @@
argument specifying the function to use. */
#undef OP
#define OP(f, a, b, c, d, k, s, T) \
- do \
+ do \
{ \
a += f (b, c, d) + correct_words[k] + T; \
CYCLIC (a, s); \
Index: ccvs/lib/md5.h
diff -u ccvs/lib/md5.h:1.10 ccvs/lib/md5.h:1.11
--- ccvs/lib/md5.h:1.10 Mon Nov 28 02:35:49 2005
+++ ccvs/lib/md5.h Wed Jan 25 12:53:38 2006
@@ -1,6 +1,6 @@
/* Declaration of functions and data types used for MD5 sum computing
library functions.
- Copyright (C) 1995-1997,1999,2000,2001,2004,2005
+ Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -44,12 +44,6 @@
# endif
#endif
-#ifndef __attribute__
-# if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
-# define __attribute__(x)
-# endif
-#endif
-
#ifndef _LIBC
# define __md5_buffer md5_buffer
# define __md5_finish_ctx md5_finish_ctx
Index: ccvs/lib/openat.c
diff -u ccvs/lib/openat.c:1.5 ccvs/lib/openat.c:1.6
--- ccvs/lib/openat.c:1.5 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/openat.c Wed Jan 25 12:53:38 2006
@@ -23,17 +23,15 @@
#include "openat.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "fcntl--.h"
+#include "openat-priv.h"
#include "save-cwd.h"
+#include "unistd--.h"
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
+#include <stdarg.h>
+#include <stddef.h>
+#include <errno.h>
/* Replacement for Solaris' openat function.
<http://www.google.com/search?q=openat+site:docs.sun.com>
@@ -44,11 +42,8 @@
Otherwise, upon failure, set errno and return -1, as openat does.
Upon successful completion, return a file descriptor. */
int
-rpl_openat (int fd, char const *file, int flags, ...)
+openat (int fd, char const *file, int flags, ...)
{
- struct saved_cwd saved_cwd;
- int saved_errno;
- int new_fd;
mode_t mode = 0;
if (flags & O_CREAT)
@@ -56,37 +51,80 @@
va_list arg;
va_start (arg, flags);
- /* Assume that mode_t is passed compatibly with mode_t's type
- after argument promotion. */
- mode = va_arg (arg, mode_t);
+ /* If mode_t is narrower than int, use the promoted type (int),
+ not mode_t. Use sizeof to guess whether mode_t is nerrower;
+ we don't know of any practical counterexamples. */
+ if (sizeof (mode_t) < sizeof (int))
+ mode = va_arg (arg, int);
+ else
+ mode = va_arg (arg, mode_t);
va_end (arg);
}
+ return openat_permissive (fd, file, flags, mode, NULL);
+}
+
+/* Like openat (FD, FILE, FLAGS, MODE), but if CWD_ERRNO is
+ nonnull, set *CWD_ERRNO to an errno value if unable to save
+ or restore the initial working directory. This is needed only
+ the first time remove.c's remove_dir opens a command-line
+ directory argument.
+
+ If a previous attempt to restore the current working directory
+ failed, then we must not even try to access a `.'-relative name.
+ It is the caller's responsibility not to call this function
+ in that case. */
+
+int
+openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno)
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ int err;
+ bool save_ok;
+
if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
return open (file, flags, mode);
- if (save_cwd (&saved_cwd) != 0)
- openat_save_fail (errno);
+ {
+ char *proc_file;
+ BUILD_PROC_NAME (proc_file, fd, file);
+ err = open (proc_file, flags, mode);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= err || ! EXPECTED_ERRNO (errno))
+ return err;
+ }
- if (fchdir (fd) != 0)
+ save_ok = (save_cwd (&saved_cwd) == 0);
+ if (! save_ok)
{
- saved_errno = errno;
- free_cwd (&saved_cwd);
- errno = saved_errno;
- return -1;
+ if (! cwd_errno)
+ openat_save_fail (errno);
+ *cwd_errno = errno;
}
- new_fd = open (file, flags, mode);
+ err = fchdir (fd);
saved_errno = errno;
- if (restore_cwd (&saved_cwd) != 0)
- openat_restore_fail (errno);
+ if (! err)
+ {
+ err = open (file, flags, mode);
+ saved_errno = errno;
+ if (save_ok && restore_cwd (&saved_cwd) != 0)
+ {
+ if (! cwd_errno)
+ openat_restore_fail (errno);
+ *cwd_errno = errno;
+ }
+ }
free_cwd (&saved_cwd);
-
errno = saved_errno;
- return new_fd;
+ return err;
}
#if !HAVE_FDOPENDIR
@@ -110,27 +148,37 @@
int saved_errno;
DIR *dir;
- if (save_cwd (&saved_cwd) != 0)
- openat_save_fail (errno);
+ char *proc_file;
+ BUILD_PROC_NAME (proc_file, fd, ".");
+ dir = opendir (proc_file);
+ saved_errno = errno;
- if (fchdir (fd) != 0)
+ /* If the syscall fails with an expected errno value, resort to
+ save_cwd/restore_cwd. */
+ if (! dir && EXPECTED_ERRNO (saved_errno))
{
- saved_errno = errno;
- free_cwd (&saved_cwd);
- errno = saved_errno;
- return NULL;
- }
+ if (save_cwd (&saved_cwd) != 0)
+ openat_save_fail (errno);
- dir = opendir (".");
- saved_errno = errno;
+ if (fchdir (fd) != 0)
+ {
+ dir = NULL;
+ saved_errno = errno;
+ }
+ else
+ {
+ dir = opendir (".");
+ saved_errno = errno;
+
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+ }
- if (restore_cwd (&saved_cwd) != 0)
- openat_restore_fail (errno);
+ free_cwd (&saved_cwd);
+ }
- free_cwd (&saved_cwd);
if (dir)
close (fd);
-
errno = saved_errno;
return dir;
}
@@ -151,32 +199,42 @@
int saved_errno;
int err;
- if (fd == AT_FDCWD)
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
return (flag == AT_SYMLINK_NOFOLLOW
? lstat (file, st)
: stat (file, st));
+ {
+ char *proc_file;
+ BUILD_PROC_NAME (proc_file, fd, file);
+ err = (flag == AT_SYMLINK_NOFOLLOW
+ ? lstat (proc_file, st)
+ : stat (proc_file, st));
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= err || ! EXPECTED_ERRNO (errno))
+ return err;
+ }
+
if (save_cwd (&saved_cwd) != 0)
openat_save_fail (errno);
- if (fchdir (fd) != 0)
+ err = fchdir (fd);
+ saved_errno = errno;
+
+ if (! err)
{
+ err = (flag == AT_SYMLINK_NOFOLLOW
+ ? lstat (file, st)
+ : stat (file, st));
saved_errno = errno;
- free_cwd (&saved_cwd);
- errno = saved_errno;
- return -1;
- }
- err = (flag == AT_SYMLINK_NOFOLLOW
- ? lstat (file, st)
- : stat (file, st));
- saved_errno = errno;
-
- if (restore_cwd (&saved_cwd) != 0)
- openat_restore_fail (errno);
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+ }
free_cwd (&saved_cwd);
-
errno = saved_errno;
return err;
}
@@ -195,28 +253,36 @@
int saved_errno;
int err;
- if (fd == AT_FDCWD)
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
return (flag == AT_REMOVEDIR ? rmdir (file) : unlink (file));
+ {
+ char *proc_file;
+ BUILD_PROC_NAME (proc_file, fd, file);
+ err = (flag == AT_REMOVEDIR ? rmdir (proc_file) : unlink (proc_file));
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= err || ! EXPECTED_ERRNO (errno))
+ return err;
+ }
+
if (save_cwd (&saved_cwd) != 0)
openat_save_fail (errno);
- if (fchdir (fd) != 0)
+ err = fchdir (fd);
+ saved_errno = errno;
+
+ if (! err)
{
+ err = (flag == AT_REMOVEDIR ? rmdir (file) : unlink (file));
saved_errno = errno;
- free_cwd (&saved_cwd);
- errno = saved_errno;
- return -1;
- }
- err = (flag == AT_REMOVEDIR ? rmdir (file) : unlink (file));
- saved_errno = errno;
-
- if (restore_cwd (&saved_cwd) != 0)
- openat_restore_fail (errno);
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+ }
free_cwd (&saved_cwd);
-
errno = saved_errno;
return err;
}
Index: ccvs/lib/openat.h
diff -u ccvs/lib/openat.h:1.5 ccvs/lib/openat.h:1.6
--- ccvs/lib/openat.h:1.5 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/openat.h Wed Jan 25 12:53:38 2006
@@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
+#include <stdbool.h>
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
@@ -35,30 +36,39 @@
#endif
#ifndef AT_FDCWD
-# define AT_FDCWD (-3041965) /* same value as Solaris 9 */
-# define AT_SYMLINK_NOFOLLOW 4096 /* same value as Solaris 9 */
-# define AT_REMOVEDIR (0x1) /* same value as Solaris 9 */
-
-# ifdef __OPENAT_PREFIX
-# undef openat
-# define __OPENAT_CONCAT(x, y) x ## y
-# define __OPENAT_XCONCAT(x, y) __OPENAT_CONCAT (x, y)
-# define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y)
-# define openat __OPENAT_ID (openat)
+/* Use the same values as Solaris 9. This shouldn't matter, but
+ there's no real reason to differ. */
+# define AT_FDCWD (-3041965)
+# define AT_SYMLINK_NOFOLLOW 4096
+# define AT_REMOVEDIR 1
+#endif
+
+#ifdef __OPENAT_PREFIX
+
+# undef openat
+# define __OPENAT_CONCAT(x, y) x ## y
+# define __OPENAT_XCONCAT(x, y) __OPENAT_CONCAT (x, y)
+# define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y)
+# define openat __OPENAT_ID (openat)
int openat (int fd, char const *file, int flags, /* mode_t mode */ ...);
-# if ! HAVE_FDOPENDIR
-# define fdopendir __OPENAT_ID (fdopendir)
-# endif
+int openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno);
+# if ! HAVE_FDOPENDIR
+# define fdopendir __OPENAT_ID (fdopendir)
+# endif
DIR *fdopendir (int fd);
-# define fstatat __OPENAT_ID (fstatat)
+# define fstatat __OPENAT_ID (fstatat)
int fstatat (int fd, char const *file, struct stat *st, int flag);
-# define unlinkat __OPENAT_ID (unlinkat)
+# define unlinkat __OPENAT_ID (unlinkat)
int unlinkat (int fd, char const *file, int flag);
-void openat_restore_fail (int) ATTRIBUTE_NORETURN;
-void openat_save_fail (int) ATTRIBUTE_NORETURN;
-# else
-# define openat_restore_fail(Errno) /* empty */
-# define openat_save_fail(Errno) /* empty */
-# endif
+
+#else
+
+# define openat_permissive(Fd, File, Flags, Mode, Cwd_errno) \
+ openat (Fd, File, Flags, Mode)
#endif
+
+int mkdirat (int fd, char const *file, mode_t mode);
+void openat_restore_fail (int) ATTRIBUTE_NORETURN;
+void openat_save_fail (int) ATTRIBUTE_NORETURN;
Index: ccvs/lib/quotearg.c
diff -u ccvs/lib/quotearg.c:1.5 ccvs/lib/quotearg.c:1.6
--- ccvs/lib/quotearg.c:1.5 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/quotearg.c Wed Jan 25 12:53:38 2006
@@ -1,7 +1,7 @@
/* quotearg.c - quote arguments for output
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software
- Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 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
@@ -307,6 +307,9 @@
STORE ('\\');
STORE ('?');
break;
+
+ default:
+ break;
}
break;
@@ -454,6 +457,9 @@
case '[': case '\\': case '^':
case '`': case '|':
goto use_shell_always_quoting_style;
+
+ default:
+ break;
}
}
Index: ccvs/lib/regex_internal.h
diff -u ccvs/lib/regex_internal.h:1.9 ccvs/lib/regex_internal.h:1.10
--- ccvs/lib/regex_internal.h:1.9 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/regex_internal.h Wed Jan 25 12:53:38 2006
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <address@hidden>.
@@ -182,6 +182,10 @@
# if BITSET_WORD_BITS <= SBC_MAX
# error "Invalid SBC_MAX"
# endif
+ #elif BITSET_WORD_MAX == (0xffffffff + 2) * 0xffffffff
+/* Work around a bug in 64-bit PGC (before version 6.1-2), where the
+ preprocessor mishandles large unsigned values as if they were signed. */
+# define BITSET_WORD_BITS 64
#else
# error "Add case for new bitset_word size"
#endif
Index: ccvs/lib/save-cwd.c
diff -u ccvs/lib/save-cwd.c:1.12 ccvs/lib/save-cwd.c:1.13
--- ccvs/lib/save-cwd.c:1.12 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/save-cwd.c Wed Jan 25 12:53:38 2006
@@ -75,12 +75,8 @@
cwd->desc = open (".", O_RDONLY);
if (cwd->desc < 0)
{
- cwd->desc = open (".", O_WRONLY);
- if (cwd->desc < 0)
- {
- cwd->name = xgetcwd ();
- return cwd->name ? 0 : -1;
- }
+ cwd->name = xgetcwd ();
+ return cwd->name ? 0 : -1;
}
return 0;
Index: ccvs/lib/stdbool_.h
diff -u ccvs/lib/stdbool_.h:1.2 ccvs/lib/stdbool_.h:1.3
--- ccvs/lib/stdbool_.h:1.2 Mon May 23 17:44:32 2005
+++ ccvs/lib/stdbool_.h Wed Jan 25 12:53:38 2006
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
Written by Bruno Haible <address@hidden>, 2001.
This program is free software; you can redistribute it and/or modify
@@ -70,8 +70,26 @@
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
-#if !(defined __cplusplus || defined __BEOS__)
+#if defined __cplusplus || defined __BEOS__
+ /* A compiler known to have 'bool'. */
+ /* If the compiler already has both 'bool' and '_Bool', we can assume they
+ are the same types. */
# if address@hidden@
+typedef bool _Bool;
+# endif
+#else
+# if @HAVE__BOOL@
+# if defined __HP_cc || defined __xlc__
+ /* Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
+ the built-in _Bool type is used. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ Override it. */
+# define _Bool signed char
+enum { false = 0, true = 1 };
+# endif
+# else
# if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
/* Avoid stupid "warning: _Bool is a keyword in ISO C99". */
# define _Bool signed char
@@ -80,8 +98,6 @@
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
-#else
-typedef bool _Bool;
#endif
#define bool _Bool
Index: ccvs/lib/stdint_.h
diff -u ccvs/lib/stdint_.h:1.4 ccvs/lib/stdint_.h:1.5
--- ccvs/lib/stdint_.h:1.4 Wed Dec 7 10:49:28 2005
+++ ccvs/lib/stdint_.h Wed Jan 25 12:53:38 2006
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
Written by Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
@@ -33,6 +33,12 @@
#if defined(__FreeBSD__)
# include <sys/inttypes.h>
#endif
+#if defined(__linux__) && HAVE_SYS_BITYPES_H
+ /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
+ int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
+ included by <sys/types.h>. */
+# include <sys/bitypes.h>
+#endif
#if defined(__sun) && HAVE_SYS_INTTYPES_H
# include <sys/inttypes.h>
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
@@ -48,7 +54,7 @@
UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
# define _STDINT_H_HAVE_SYSTEM_INTTYPES
#endif
-#if !(defined(UNIX_CYGWIN32) && defined(__BIT_TYPES_DEFINED__))
+#if !((defined(UNIX_CYGWIN32) || defined(__linux__)) &&
defined(__BIT_TYPES_DEFINED__))
# define _STDINT_H_NEED_SIGNED_INT_TYPES
#endif
@@ -238,8 +244,8 @@
#define SIG_ATOMIC_MIN 0
#define SIG_ATOMIC_MAX 127
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
+#ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
+# define SIZE_MAX ((size_t)~(size_t)0)
#endif
/* wchar_t limits already defined in <stddef.h>. */
Index: ccvs/lib/strftime.c
diff -u ccvs/lib/strftime.c:1.10 ccvs/lib/strftime.c:1.11
--- ccvs/lib/strftime.c:1.10 Tue Oct 4 02:34:54 2005
+++ ccvs/lib/strftime.c Wed Jan 25 12:53:38 2006
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005 Free Software
+/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library.
@@ -47,7 +47,7 @@
# include <time.h>
# endif
#endif
-#if HAVE_TZNAME
+#if HAVE_TZNAME && ! defined tzname
extern char *tzname[];
#endif
Index: ccvs/lib/vasnprintf.c
diff -u ccvs/lib/vasnprintf.c:1.4 ccvs/lib/vasnprintf.c:1.5
--- ccvs/lib/vasnprintf.c:1.4 Mon May 23 17:44:33 2005
+++ ccvs/lib/vasnprintf.c Wed Jan 25 12:53:38 2006
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-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
@@ -334,28 +334,28 @@
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.30103 /* binary -> decimal */
- * 2 /* estimate for FLAG_GROUP */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Multiply by 2, as an estimate for FLAG_GROUP. */
+ tmp_length = xsum (tmp_length, tmp_length);
+ /* Add 1, to account for a leading sign. */
+ tmp_length = xsum (tmp_length, 1);
break;
case 'o':
@@ -365,8 +365,7 @@
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -374,15 +373,17 @@
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
- + 1 /* turn floor into ceil */
- + 1; /* account for leading sign */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 1, to account for a leading sign. */
+ tmp_length = xsum (tmp_length, 1);
break;
case 'x': case 'X':
@@ -392,8 +393,7 @@
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
@@ -401,15 +401,17 @@
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
- + 1 /* turn floor into ceil */
- + 2; /* account for leading sign or alternate form */
+ + 1; /* turn floor into ceil */
+ if (tmp_length < precision)
+ tmp_length = precision;
+ /* Add 2, to account for a leading sign or alternate
form. */
+ tmp_length = xsum (tmp_length, 2);
break;
case 'f': case 'F':
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/lib ChangeLog chdir-long.c getopt.c gettim...,
Mark D. Baushke <=