summaryrefslogtreecommitdiff
path: root/lib/glob
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-09 16:13:32 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-09 16:15:01 -0700
commit2d698b6e42d8dca191ac795ef5dba3bf62496eec (patch)
treeac5e0b67043c50f49160e9fe407435706cf30444 /lib/glob
parentf1250933e4a2ac09a3d0b25b3877068e12f44da5 (diff)
downloadvyatta-bash-2d698b6e42d8dca191ac795ef5dba3bf62496eec.tar.gz
vyatta-bash-2d698b6e42d8dca191ac795ef5dba3bf62496eec.zip
Integrate bash 3.2 version
This is merge of current Debian stable (Lenny) version of Bash with Vyatta changes.
Diffstat (limited to 'lib/glob')
-rw-r--r--lib/glob/Makefile.in3
-rw-r--r--lib/glob/glob.c11
-rw-r--r--lib/glob/sm_loop.c5
-rw-r--r--lib/glob/smatch.c1
-rw-r--r--lib/glob/xmbsrtowcs.c3
5 files changed, 13 insertions, 10 deletions
diff --git a/lib/glob/Makefile.in b/lib/glob/Makefile.in
index 9bb4dd3..9f53a7b 100644
--- a/lib/glob/Makefile.in
+++ b/lib/glob/Makefile.in
@@ -33,7 +33,7 @@ CC = @CC@
RANLIB = @RANLIB@
AR = @AR@
ARFLAGS = @ARFLAGS@
-RM = rm
+RM = rm -f
CP = cp
MV = mv
@@ -59,6 +59,7 @@ CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \
# Here is a rule for making .o files from .c files that doesn't force
# the type of the machine (like -sun3) into the flags.
.c.o:
+ $(RM) $@
$(CC) -c $(CCFLAGS) $<
# The name of the library target.
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
index 1453b06..08a7da8 100644
--- a/lib/glob/glob.c
+++ b/lib/glob/glob.c
@@ -73,7 +73,7 @@
#endif
extern void throw_to_top_level __P((void));
-extern int test_eaccess __P((char *, int));
+extern int sh_eaccess __P((char *, int));
extern int extended_glob;
@@ -184,7 +184,7 @@ mbskipname (pat, dname)
{
int ret;
wchar_t *pat_wc, *dn_wc;
- size_t pat_n, dn_n, n;
+ size_t pat_n, dn_n;
pat_n = xdupmbstowcs (&pat_wc, NULL, pat);
dn_n = xdupmbstowcs (&dn_wc, NULL, dname);
@@ -293,7 +293,7 @@ dequote_pathname (pathname)
# define GLOB_TESTNAME(name) (lstat (name, &finfo))
#else /* !HAVE_LSTAT */
# if !defined (AFS)
-# define GLOB_TESTNAME(name) (test_eaccess (nextname, F_OK))
+# define GLOB_TESTNAME(name) (sh_eaccess (nextname, F_OK))
# else /* AFS */
# define GLOB_TESTNAME(name) (access (nextname, F_OK))
# endif /* AFS */
@@ -470,7 +470,7 @@ glob_vector (pat, dir, flags)
while (1)
{
/* Make globbing interruptible in the shell. */
- if (interrupt_state)
+ if (interrupt_state || terminating_signal)
{
lose = 1;
break;
@@ -541,6 +541,9 @@ glob_vector (pat, dir, flags)
/* Here free the strings we have got. */
while (lastlink)
{
+ /* Since we build the list in reverse order, the first N entries
+ will be allocated with malloc, if firstmalloc is set, from
+ lastlink to firstmalloc. */
if (firstmalloc)
{
if (lastlink == firstmalloc)
diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c
index d66ad18..41b0759 100644
--- a/lib/glob/sm_loop.c
+++ b/lib/glob/sm_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -15,7 +15,6 @@
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
-
int FCT __P((CHAR *, CHAR *, int));
static int GMATCH __P((CHAR *, CHAR *, CHAR *, CHAR *, int));
@@ -693,7 +692,7 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
return (FNM_NOMATCH);
case L('?'): /* match zero or one of the patterns */
- case L('@'): /* match exactly one of the patterns */
+ case L('@'): /* match one (or more) of the patterns */
/* If we can get away with no matches, don't even bother. Just
call gmatch on the rest of the pattern and return success if
it succeeds. */
diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c
index 12fde3d..be4f927 100644
--- a/lib/glob/smatch.c
+++ b/lib/glob/smatch.c
@@ -247,7 +247,6 @@ rangecmp_wc (c1, c2)
{
static wchar_t s1[2] = { L' ', L'\0' };
static wchar_t s2[2] = { L' ', L'\0' };
- int ret;
if (c1 == c2)
return 0;
diff --git a/lib/glob/xmbsrtowcs.c b/lib/glob/xmbsrtowcs.c
index f8c29b9..83b67b4 100644
--- a/lib/glob/xmbsrtowcs.c
+++ b/lib/glob/xmbsrtowcs.c
@@ -145,7 +145,8 @@ xdupmbstowcs (destp, indicesp, src)
/* In case SRC or DESP is NULL, conversion doesn't take place. */
if (src == NULL || destp == NULL)
{
- *destp = NULL;
+ if (destp)
+ *destp = NULL;
return (size_t)-1;
}