diff options
author | Roland McGrath <roland@gnu.org> | 1995-08-31 00:02:32 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-08-31 00:02:32 +0000 |
commit | a993273c0d4d1907028adee7a2ae012826fd316c (patch) | |
tree | 3b1f5f64ea2b79fff7a61283d1ae60ac9291f38f /posix | |
parent | 18926cf415b65008c849b592209a85f733be39f7 (diff) | |
download | glibc-a993273c0d4d1907028adee7a2ae012826fd316c.tar.gz glibc-a993273c0d4d1907028adee7a2ae012826fd316c.tar.xz glibc-a993273c0d4d1907028adee7a2ae012826fd316c.zip |
Wed Aug 30 16:44:55 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/mach/hurd/select.c: Deal with out of order replies during io_select request loop. Handle MACH_RCV_TIMED_OUT error from requests. * hurd/intr-msg.c: If the user passed the MACH_RCV_TIMEOUT option, distinguish MACH_RCV_TIMED_OUT from EINTR. * posix/glob.c (glob): Use realloc to extend strings for GLOB_MARK slash. (glob_in_dir): Don't allocate extra byte here. * sysdeps/i386/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Decrement the DT_RELSZ value for the skipped reloc.
Diffstat (limited to 'posix')
-rw-r--r-- | posix/glob.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/posix/glob.c b/posix/glob.c index 1354150653..84fe19420b 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -417,7 +417,17 @@ glob (pattern, flags, errfunc, pglob) for (i = oldcount; i < pglob->gl_pathc; ++i) if (__lstat (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) - strcat (pglob->gl_pathv[i], "/"); + { + size_t len = strlen (pglob->gl_pathv[i]) + 2; + char *new = realloc (pglob->gl_pathv[i], len); + if (new == NULL) + { + globfree (pglob); + return GLOB_NOSPACE; + } + strcpy (&new[len - 2], "/"); + pglob->gl_pathv[i] = new; + } } if (!(flags & GLOB_NOSORT)) @@ -617,7 +627,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (len == 0) len = strlen (name); new->name - = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1); + = (char *) malloc (len + 1); if (new->name == NULL) goto memory_error; memcpy ((__ptr_t) new->name, name, len); @@ -635,7 +645,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) nfound = 1; names = (struct globlink *) __alloca (sizeof (struct globlink)); names->next = NULL; - names->name = (char *) malloc (len + ((flags & GLOB_MARK) ? 1 : 0) + 1); + names->name = (char *) malloc (len + 1); if (names->name == NULL) goto memory_error; memcpy (names->name, pattern, len); |