summary refs log tree commit diff
path: root/posix/wordexp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-06 23:45:24 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-06 23:45:24 +0000
commit6796bc807aa3808f6afb5da42932e437bdd183cf (patch)
treef0610b5aebf183e95afb9f70c30d77ea82f9ef9e /posix/wordexp.c
parentbaa3334acc20834b32be1abf96f5942367c31a06 (diff)
downloadglibc-6796bc807aa3808f6afb5da42932e437bdd183cf.tar.gz
glibc-6796bc807aa3808f6afb5da42932e437bdd183cf.tar.xz
glibc-6796bc807aa3808f6afb5da42932e437bdd183cf.zip
Update.
1998-09-06 09:53 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* Makeconfig (+gccwarn): Remove -Wno-parentheses.

	* elf/dl-open.c: Quiet -Wparentheses warnings.
	* iconvdata/johab.c: Likewise.
	* iconvdata/uhc.c: Likewise.
	* inet/inet_net.c: Likewise.
	* io/fts.c: Likewise.
	* locale/newlocale.c: Likewise.
	* misc/getttyent.c: Likewise.
	* misc/mntent_r.c: Likewise.
	* misc/ttyslot.c: Likewise.
	* nscd/nscd_conf.c: Likewise.
	* nss/nsswitch.c: Likewise.
	* resolv/gethnamaddr.c: Likewise.
	* resolv/nsap_addr.c: Likewise.
	* resolv/res_debug.c: Likewise.
	* stdio-common/_itoa.c: Likewise.
	* stdlib/strtod.c: Likewise.
	* string/strverscmp.c: Likewise.
	* sunrpc/svc.c: Likewise.
	* sysdeps/libm-ieee754/e_cosh.c: Likewise.
	* sysdeps/libm-ieee754/e_gamma_r.c: Likewise.
	* sysdeps/libm-ieee754/e_sinh.c: Likewise.
	* sysdeps/posix/getaddrinfo.c: Likewise.

	* include/dlfcn.h: Likewise.
	* elf/dlfcn.h: Declare dladdr only for __USE_GNU.
	Define RTLD_DEFAULT.
Diffstat (limited to 'posix/wordexp.c')
-rw-r--r--posix/wordexp.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/posix/wordexp.c b/posix/wordexp.c
index fe3e2b2cea..dff5d30dad 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -2049,8 +2049,8 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
   ifs = getenv ("IFS");
 
   if (!ifs)
-    /* NULL IFS means no field-splitting is to be performed */
-    ifs = strcpy (ifs_white, "");
+    /* IFS unset - use <space><tab><newline>. */
+    ifs = strcpy (ifs_white, " \t\n");
   else
     {
       char *ifsch = ifs;
@@ -2082,22 +2082,6 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
   for (words_offset = 0 ; words[words_offset] ; ++words_offset)
     switch (words[words_offset])
       {
-      case '\n':
-      case '|':
-      case '&':
-      case ';':
-      case '<':
-      case '>':
-      case '(':
-      case ')':
-	case '{':
-      case '}':
-	/* Fail */
-	wordfree (pwordexp);
-	pwordexp->we_wordc = 0;
-	pwordexp->we_wordv = old_wordv;
-	return WRDE_BADCHAR;
-
       case '\\':
 	error = parse_backslash (&word, &word_length, &max_length, words,
 				 &words_offset);
@@ -2175,6 +2159,16 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
 	/* Is it a field separator? */
 	if (strchr (ifs, words[words_offset]) == NULL)
 	  {
+	    /* Not a field separator -- but is it a valid word char? */
+	    if (strchr ("\n|&;<>(){}", words[words_offset]))
+	      {
+		/* Fail */
+		wordfree (pwordexp);
+		pwordexp->we_wordc = 0;
+		pwordexp->we_wordv = old_wordv;
+		return WRDE_BADCHAR;
+	      }
+
 	    /* "Ordinary" character -- add it to word */
 
 	    word = w_addchar (word, &word_length, &max_length,