aboutsummaryrefslogtreecommitdiff
path: root/gnulib/import/glob.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-02-22 20:31:54 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2020-02-22 20:37:18 -0500
commit5df4cba632201687fd8472663138fbeffaa8f315 (patch)
tree330eb3060e16abd42ff22c501843164d1a97b3e5 /gnulib/import/glob.c
parent7e702065b4730379730c58a2c72e8715526c8875 (diff)
downloadbinutils-5df4cba632201687fd8472663138fbeffaa8f315.zip
binutils-5df4cba632201687fd8472663138fbeffaa8f315.tar.gz
binutils-5df4cba632201687fd8472663138fbeffaa8f315.tar.bz2
gdb: update gnulib import
This is mostly to get this commit from gnulib: e22cd2677a4b7beacbf30b93bb0559f7b89f96ce Add ‘extern "C"’ to count-one-bits.h etc. ... which fixes this compilation problem I observed with clang++: CXXLD gdb arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)' <more such undefined references> I built-tested on GNU/Linux x86-64 (gcc-9 and clang-9) as well as with the x86_64-w64-mingw32-gcc cross-compiler. gnulib/ChangeLog: * update-gnulib.sh (GNULIB_COMMIT_SHA1): Bump to e22cd2677a4b7beacbf30b93bb0559f7b89f96ce. * Makefile.in, config.in, configure, import/*: Re-generate.
Diffstat (limited to 'gnulib/import/glob.c')
-rw-r--r--gnulib/import/glob.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c
index 6f57860..f1b20d4 100644
--- a/gnulib/import/glob.c
+++ b/gnulib/import/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 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
@@ -72,6 +72,10 @@
# define __glob glob
# define __getlogin_r(buf, len) getlogin_r (buf, len)
# define __lstat64(fname, buf) lstat (fname, buf)
+# ifdef __MINGW32__
+ /* Avoid GCC warning. mingw has an unused __stat64 macro. */
+# undef __stat64
+# endif
# define __stat64(fname, buf) stat (fname, buf)
# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
# define struct_stat64 struct stat
@@ -839,10 +843,11 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
{
size_t home_len = strlen (p->pw_dir);
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
+ /* dirname contains end_name; we can't free it now. */
+ char *prev_dirname =
+ (__glibc_unlikely (malloc_dirname) ? dirname : NULL);
char *d;
- if (__glibc_unlikely (malloc_dirname))
- free (dirname);
malloc_dirname = 0;
if (glob_use_alloca (alloca_used, home_len + rest_len + 1))
@@ -853,6 +858,7 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
dirname = malloc (home_len + rest_len + 1);
if (dirname == NULL)
{
+ free (prev_dirname);
scratch_buffer_free (&pwtmpbuf);
retval = GLOB_NOSPACE;
goto out;
@@ -864,6 +870,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
d = mempcpy (d, end_name, rest_len);
*d = '\0';
+ free (prev_dirname);
+
dirlen = home_len + rest_len;
dirname_modified = 1;
}