summaryrefslogtreecommitdiff
path: root/pathexp.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2000-03-17 21:46:59 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:53 +0000
commitbb70624e964126b7ac4ff085ba163a9c35ffa18f (patch)
treeba2dd4add13ada94b1899c6d4aca80195b80b74b /pathexp.c
parentb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (diff)
downloadbash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.gz
Imported from ../bash-2.04.tar.gz.
Diffstat (limited to 'pathexp.c')
-rw-r--r--pathexp.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/pathexp.c b/pathexp.c
index 3c02effc..6f0f5472 100644
--- a/pathexp.c
+++ b/pathexp.c
@@ -16,7 +16,7 @@
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include "config.h"
@@ -196,7 +196,22 @@ shell_glob_filename (pathname)
else if (i != 0) /* other error codes not in POSIX.2 */
filenames.gl_pathv = (char **)NULL;
- return (filenames.gl_pathv);
+ results = filenames.gl_pathv;
+
+ if (results && ((GLOB_FAILED (results)) == 0))
+ {
+ if (should_ignore_glob_matches ())
+ ignore_glob_matches (results);
+ if (results && results[0])
+ sort_char_array (results);
+ else
+ {
+ FREE (results);
+ results = (char **)NULL;
+ }
+ }
+
+ return (results);
#else /* !USE_POSIX_GLOB_LIBRARY */
@@ -298,7 +313,7 @@ ignore_globbed_names (names, name_func)
for (i = 0; names[i]; i++)
;
- newnames = (char **)xmalloc ((i + 1) * sizeof (char *));
+ newnames = alloc_array (i + 1);
for (n = i = 0; names[i]; i++)
{