Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Hod Greeley
Wed, 04 Nov 1992 18:31
glob.c patch.
Author: Hod Greeley
Date: Wed, 04 Nov 1992 18:31
Date: Wed, 04 Nov 1992 18:31
68 lines
2546 bytes
2546 bytes
Hi,
spoke a little too quickly. The closedir should done within the else
statement following the opendir. Here's a corrected patch.
*** /reef/hod/src/make-3.62/glob/glob.c Sat Oct 19 16:39:23 1991
--- glob.c Wed Nov 4 23:24:49 1992
***************
*** 456,482 ****
return GLOB_ABEND;
}
else
! while ((d = readdir(stream)) != NULL)
! if (REAL_DIR_ENTRY(d) &&
! fnmatch(pattern, d->d_name,
! (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
! ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0)
! {
! struct globlink *new = (struct globlink *)
! __alloca(sizeof(struct globlink));
! size_t len = D_NAMLEN(d);
! new->name = (char *) malloc(len +
! ((flags & GLOB_MARK) ? 1 : 0) + 1);
! if (new->name == NULL)
! goto memory_error;
! memcpy((char *) new->name, d->d_name, len);
! if (flags & GLOB_MARK)
! new->name[len++] = '/';
! new->name[len] = '\0';
! new->next = names;
! names = new;
! ++nfound;
! }
}
if (nfound == 0 && (flags & GLOB_NOCHECK))
--- 456,485 ----
return GLOB_ABEND;
}
else
! {
! while ((d = readdir(stream)) != NULL)
! if (REAL_DIR_ENTRY(d) &&
! fnmatch(pattern, d->d_name,
! (!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) |
! ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)) == 0)
! {
! struct globlink *new = (struct globlink *)
! __alloca(sizeof(struct globlink));
! size_t len = D_NAMLEN(d);
! new->name = (char *) malloc(len +
! ((flags & GLOB_MARK) ? 1 : 0) + 1);
! if (new->name == NULL)
! goto memory_error;
! memcpy((char *) new->name, d->d_name, len);
! if (flags & GLOB_MARK)
! new->name[len++] = '/';
! new->name[len] = '\0';
! new->next = names;
! names = new;
! ++nfound;
! }
! closedir(stream);
! }
}
if (nfound == 0 && (flags & GLOB_NOCHECK))
Hod Greeley
hod@cucbs.chem.columbia.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads