From cc60175e8cecbedb4c555379c3c667c9cf9420fa Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 23 Jul 1998 14:59:16 +0000 Subject: Update. 1998-07-23 Ulrich Drepper * sysdeps/generic/glob.c: Fix two problems with GLOB_DOOFFS. Reported by bwelling@anomaly.munge.com [PR libc/720]. * sysdeps/libm-ieee754/k_standard.c: Return NAN for libm not in SVID more for gamma(x) with x interger <= 0. Reported by Stephen L Moshier . * math/libm-test.c (gamma_test): Add test for gamma(-1) and gamma(0). Correct test for SVID version of gamma. * sysdeps/libm-ieee754/w_gamma.c: Use correct matherr call in SVID emulation mode. * sysdeps/libm-ieee754/w_gammaf.c: Likewise. * sysdeps/libm-ieee754/w_gammal.c: Likewise. * string/string.h: Don't use string function optimization for C++ as long as we use macros. --- sysdeps/generic/glob.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index 9182c0585a..56bc0fbd53 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -693,7 +693,7 @@ glob (pattern, flags, errfunc, pglob) appending the results to PGLOB. */ for (i = 0; i < dirs.gl_pathc; ++i) { - int oldcount; + int old_pathc; #ifdef SHELL { @@ -709,7 +709,7 @@ glob (pattern, flags, errfunc, pglob) } #endif /* SHELL. */ - oldcount = pglob->gl_pathc; + old_pathc = pglob->gl_pathc; status = glob_in_dir (filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~(GLOB_NOCHECK | GLOB_ERR)), @@ -727,8 +727,8 @@ glob (pattern, flags, errfunc, pglob) /* Stick the directory on the front of each name. */ if (prefix_array (dirs.gl_pathv[i], - &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount)) + &pglob->gl_pathv[old_pathc], + pglob->gl_pathc - old_pathc)) { globfree (&dirs); globfree (pglob); @@ -781,9 +781,14 @@ glob (pattern, flags, errfunc, pglob) if (dirlen > 0) { /* Stick the directory on the front of each name. */ + int ignore = oldcount; + + if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs) + ignore = pglob->gl_offs; + if (prefix_array (dirname, - &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount)) + &pglob->gl_pathv[ignore], + pglob->gl_pathc - ignore)) { globfree (pglob); return GLOB_NOSPACE; @@ -815,10 +820,17 @@ glob (pattern, flags, errfunc, pglob) } if (!(flags & GLOB_NOSORT)) - /* Sort the vector. */ - qsort ((__ptr_t) &pglob->gl_pathv[oldcount], - pglob->gl_pathc - oldcount, - sizeof (char *), collated_compare); + { + /* Sort the vector. */ + int non_sort = oldcount; + + if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount) + non_sort = pglob->gl_offs; + + qsort ((__ptr_t) &pglob->gl_pathv[non_sort], + pglob->gl_pathc - non_sort, + sizeof (char *), collated_compare); + } return 0; } -- cgit v1.2.3