GNU C Library master sources branch master updated. glibc-2.19-801-g888c679
siddhesh@sourceware.org
siddhesh@sourceware.org
Thu Jul 10 09:02:00 GMT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 888c679ba406e89d86bdfbde033e307f5af5198f (commit)
via 180e0e4b29e4950cd411144c7b9dab1f850853d9 (commit)
via d22f1fe2f369a273533e50d757c4590adf147ef1 (commit)
via 12f2254b815056bb897a25a0c6dee0122aef52ac (commit)
via c3c7c3604fdf934d7a8ec70d79915cd8c8984ad1 (commit)
via d62aa75af1941fca6f07e107afc447b7b248e340 (commit)
from 7000d82e01dc04344eaa1772698c9b0c304a892f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=888c679ba406e89d86bdfbde033e307f5af5198f
commit 888c679ba406e89d86bdfbde033e307f5af5198f
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:24:30 2014 +0530
Sync up error.c with gnulib
Summary of changes:
- Use of !_LIBC instead of HAVE_CONFIG_H
- Code changes in [!_LIBC] that don't affect us
- Minor formatting changes
- Use __builtin_expect in shared code
- Define some macros in [_LIBC] that are used in gnulib but never
defined in glibc
- Flip macro check for STRERROR_R_CHAR_P so that it does not throw a
warning
diff --git a/ChangeLog b/ChangeLog
index 7db7bdf..a1232aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ Sync up with gnulib.
+ * misc/error.c: Use !_LIBC instead of HAVE_CONFIG_H.
+ [!_LIBC && ENABLE_NLS]: Include gettext.h.
+ [_LIBC]: Define USE_UNLOCKED_IO, _GL_ATTRIBUTE_FORMAT_PRINTF
+ and _GL_ARG_NONNULL.
+ [USE_UNLOCKED_IO]: Include unlocked-io.h.
+ [!_LIBC]: Include code for Windows and Cygwin.
+ [!_LIBC && !HAVE_DECL_STRERROR_R && !STRERROR_R_CHAR_P]:
+ Include prototype for int strerror_r.
+ [!_LIBC] (is_open): New function.
+ (flush_stdout): New function.
+ (print_errno_message): Use it.
+ (error): Likewise.
+ (error_at_line): Likewise.
+ (error_tail) Add function attribute macros. Use
+ __builtin_expect.
+
* time/strptime_l.c [_LIBC]: Define HAVE_LOCALTIME_R.
* time/strftime_l.c [_LIBC]: Define HAVE_STRFTIME.
diff --git a/misc/error.c b/misc/error.c
index 63bd309..ee0cf86 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -18,24 +18,36 @@
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-#ifdef HAVE_CONFIG_H
+#if !_LIBC
# include <config.h>
#endif
+#include "error.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if !_LIBC && ENABLE_NLS
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
#ifdef _LIBC
# include <libintl.h>
# include <stdbool.h>
# include <stdint.h>
# include <wchar.h>
# define mbsrtowcs __mbsrtowcs
+# define USE_UNLOCKED_IO 0
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
+# define _GL_ARG_NONNULL(a)
#endif
-#include "error.h"
+#if USE_UNLOCKED_IO
+# include "unlocked-io.h"
+#endif
#ifndef _
# define _(String) String
@@ -46,7 +58,7 @@
function without parameters instead. */
void (*error_print_progname) (void);
-/* This variable is incremented each time `error' is called. */
+/* This variable is incremented each time 'error' is called. */
unsigned int error_message_count;
#ifdef _LIBC
@@ -57,7 +69,7 @@ unsigned int error_message_count;
# include <limits.h>
# include <libio/libioP.h>
-/* In GNU libc we want do not want to use the common name `error' directly.
+/* In GNU libc we want do not want to use the common name 'error' directly.
Instead make it a weak alias. */
extern void __error (int status, int errnum, const char *message, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
@@ -77,11 +89,29 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
#else /* not _LIBC */
-# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
+# include <fcntl.h>
+# include <unistd.h>
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Get declarations of the native Windows API functions. */
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* Get _get_osfhandle. */
+# include "msvc-nothrow.h"
+# endif
+
+/* The gnulib override of fcntl is not needed in this file. */
+# undef fcntl
+
+# if !HAVE_DECL_STRERROR_R
# ifndef HAVE_DECL_STRERROR_R
"this configure-time declaration test was not run"
# endif
+# if STRERROR_R_CHAR_P
char *strerror_r ();
+# else
+int strerror_r ();
+# endif
# endif
/* The calling program should define program_name and set it to the
@@ -93,6 +123,51 @@ extern char *program_name;
# endif /* HAVE_STRERROR_R || defined strerror_r */
#endif /* not _LIBC */
+#if !_LIBC
+/* Return non-zero if FD is open. */
+static int
+is_open (int fd)
+{
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* On native Windows: The initial state of unassigned standard file
+ descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
+ There is no fcntl, and the gnulib replacement fcntl does not support
+ F_GETFL. */
+ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE;
+# else
+# ifndef F_GETFL
+# error Please port fcntl to your platform
+# endif
+ return 0 <= fcntl (fd, F_GETFL);
+# endif
+}
+#endif
+
+static void
+flush_stdout (void)
+{
+#if !_LIBC
+ int stdout_fd;
+
+# if GNULIB_FREOPEN_SAFER
+ /* Use of gnulib's freopen-safer module normally ensures that
+ fileno (stdout) == 1
+ whenever stdout is open. */
+ stdout_fd = STDOUT_FILENO;
+# else
+ /* POSIX states that fileno (stdout) after fclose is unspecified. But in
+ practice it is not a problem, because stdout is statically allocated and
+ the fd of a FILE stream is stored as a field in its allocated memory. */
+ stdout_fd = fileno (stdout);
+# endif
+ /* POSIX states that fflush (stdout) after fclose is unspecified; it
+ is safe in glibc, but not on all other platforms. fflush (NULL)
+ is always defined, but too draconian. */
+ if (0 <= stdout_fd && is_open (stdout_fd))
+#endif
+ fflush (stdout);
+}
+
static void
print_errno_message (int errnum)
{
@@ -100,7 +175,7 @@ print_errno_message (int errnum)
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
-# if STRERROR_R_CHAR_P || _LIBC
+# if _LIBC || STRERROR_R_CHAR_P
s = __strerror_r (errnum, errbuf, sizeof errbuf);
# else
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
@@ -124,7 +199,7 @@ print_errno_message (int errnum)
#endif
}
-static void
+static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
error_tail (int status, int errnum, const char *message, va_list args)
{
#if _LIBC
@@ -165,7 +240,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (res != len)
break;
- if (__glibc_unlikely (len >= SIZE_MAX / sizeof (wchar_t) / 2))
+ if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
{
/* This really should not happen if everything is fine. */
res = (size_t) -1;
@@ -227,7 +302,7 @@ error (int status, int errnum, const char *message, ...)
0);
#endif
- fflush (stdout);
+ flush_stdout ();
#ifdef _LIBC
_IO_flockfile (stderr);
#endif
@@ -273,6 +348,7 @@ error_at_line (int status, int errnum, const char *file_name,
|| (old_file_name != NULL
&& file_name != NULL
&& strcmp (old_file_name, file_name) == 0)))
+
/* Simply return and print nothing. */
return;
@@ -288,7 +364,7 @@ error_at_line (int status, int errnum, const char *file_name,
0);
#endif
- fflush (stdout);
+ flush_stdout ();
#ifdef _LIBC
_IO_flockfile (stderr);
#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=180e0e4b29e4950cd411144c7b9dab1f850853d9
commit 180e0e4b29e4950cd411144c7b9dab1f850853d9
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:21:27 2014 +0530
Fix -Wundef warning for HAVE_LOCALTIME_R
Define it to 0. There is a gnulib copy for this, but it is out of
sync with our copy.
diff --git a/ChangeLog b/ChangeLog
index 363564d..7db7bdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * time/strptime_l.c [_LIBC]: Define HAVE_LOCALTIME_R.
+
* time/strftime_l.c [_LIBC]: Define HAVE_STRFTIME.
* io/ftw.c: Include sys/param.h unconditionally.
diff --git a/time/strptime_l.c b/time/strptime_l.c
index 8fe623d..b3a612e 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -28,6 +28,7 @@
#include <stdbool.h>
#ifdef _LIBC
+# define HAVE_LOCALTIME_R 0
# include "../locale/localeinfo.h"
#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d22f1fe2f369a273533e50d757c4590adf147ef1
commit d22f1fe2f369a273533e50d757c4590adf147ef1
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:20:42 2014 +0530
Fix Wundef warning for HAVE_STRFTIME
Define it to 0
diff --git a/ChangeLog b/ChangeLog
index 673f0af..363564d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * time/strftime_l.c [_LIBC]: Define HAVE_STRFTIME.
+
* io/ftw.c: Include sys/param.h unconditionally.
* locale/programs/simple-hash.c [!HAVE_OBSTACK]: Remove code.
diff --git a/time/strftime_l.c b/time/strftime_l.c
index dfb7b4c..869e0b9 100644
--- a/time/strftime_l.c
+++ b/time/strftime_l.c
@@ -29,6 +29,7 @@
# define HAVE_TM_ZONE 1
# define HAVE_TZNAME 1
# define HAVE_TZSET 1
+# define HAVE_STRFTIME 0
# define MULTIBYTE_IS_FORMAT_SAFE 1
# define STDC_HEADERS 1
# include "../locale/localeinfo.h"
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=12f2254b815056bb897a25a0c6dee0122aef52ac
commit 12f2254b815056bb897a25a0c6dee0122aef52ac
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:19:21 2014 +0530
Fix -Wundef warning for HAVE_SYS_PARAM_H
Include sys/param.h unconditionally
diff --git a/ChangeLog b/ChangeLog
index dc0b76c..673f0af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * io/ftw.c: Include sys/param.h unconditionally.
+
* locale/programs/simple-hash.c [!HAVE_OBSTACK]: Remove code.
[BZ #17125]
diff --git a/io/ftw.c b/io/ftw.c
index b058b74..bf749b1 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -66,9 +66,7 @@ char *alloca ();
#include <string.h>
#include <unistd.h>
#include <not-cancel.h>
-#if HAVE_SYS_PARAM_H || defined _LIBC
-# include <sys/param.h>
-#endif
+#include <sys/param.h>
#ifdef _LIBC
# include <include/sys/stat.h>
#else
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c3c7c3604fdf934d7a8ec70d79915cd8c8984ad1
commit c3c7c3604fdf934d7a8ec70d79915cd8c8984ad1
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:18:13 2014 +0530
Fix -Wundef warning for HAVE_OBSTACK
Remove the HAVE_OBSTACK macro check and include obstack check in
include path order since we don't have a copy of obstack.h in the
current directory.
diff --git a/ChangeLog b/ChangeLog
index 72e9cf9..dc0b76c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ * locale/programs/simple-hash.c [!HAVE_OBSTACK]: Remove code.
+
[BZ #17125]
* sysdeps/unix/sysv/linux/check_pf.c (cache): Don't use
libc_freeres_ptr.
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index ef371a0..666e303 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -27,11 +27,7 @@
#include <stdint.h>
#include <sys/types.h>
-#if HAVE_OBSTACK
-# include <obstack.h>
-#else
-# include "obstack.h"
-#endif
+#include <obstack.h>
#ifdef HAVE_VALUES_H
# include <values.h>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d62aa75af1941fca6f07e107afc447b7b248e340
commit d62aa75af1941fca6f07e107afc447b7b248e340
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:15:16 2014 +0530
Fix crash when system has no ipv6 address [BZ #17125]
Here's an updated patch to fix the crash in bug-ga2 when the system
has no configured ipv6 address. I have taken a different approach of
using libc_freeres_fn instead of the libc_freeres_ptr since the former
gives better control over what is freed; we need that since cache may
or may not be allocated using malloc.
Verified that bug-ga2 works correctly in both cases and does not have
memory leaks in either of them.
diff --git a/ChangeLog b/ChangeLog
index f5b5599..72e9cf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-07-10 Siddhesh Poyarekar <siddhesh@redhat.com>
+ [BZ #17125]
+ * sysdeps/unix/sysv/linux/check_pf.c (cache): Don't use
+ libc_freeres_ptr.
+ (freecache): New function to free CACHE on exit.
+
* sunrpc/xdr.c (xdr_string): Add comment about SIZE
initialization.
diff --git a/NEWS b/NEWS
index f4c501c..3ef9162 100644
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@ Version 2.20
16882, 16885, 16888, 16890, 16912, 16915, 16916, 16917, 16918, 16922,
16927, 16928, 16932, 16943, 16958, 16965, 16966, 16967, 16977, 16978,
16984, 16990, 16996, 17009, 17022, 17031, 17042, 17048, 17050, 17058,
- 17061, 17062, 17069, 17075, 17079, 17084, 17086, 17092, 17097.
+ 17061, 17062, 17069, 17075, 17079, 17084, 17086, 17092, 17097, 17125.
* Optimized strchr implementation for AArch64. Contributed by ARM Ltd.
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 1bc1def..c7fd9b0 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -61,7 +61,7 @@ static struct cached_data noai6ai_cached =
.in6ailen = 0
};
-libc_freeres_ptr (static struct cached_data *cache);
+static struct cached_data *cache;
__libc_lock_define_initialized (static, lock);
@@ -401,6 +401,12 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
*seen_ipv6 = true;
}
+/* Free the cache if it has been allocated. */
+libc_freeres_fn (freecache)
+{
+ if (cache)
+ __free_in6ai (cache->in6ai);
+}
void
__free_in6ai (struct in6addrinfo *ai)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 30 +++++++++++
NEWS | 2 +-
io/ftw.c | 4 +-
locale/programs/simple-hash.c | 6 +--
misc/error.c | 96 ++++++++++++++++++++++++++++++++----
sysdeps/unix/sysv/linux/check_pf.c | 8 +++-
time/strftime_l.c | 1 +
time/strptime_l.c | 1 +
8 files changed, 128 insertions(+), 20 deletions(-)
hooks/post-receive
--
GNU C Library master sources
More information about the Glibc-cvs
mailing list