Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/archival/libunarchive/find_list_entry.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 815 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 6  Line 6 
6   */   */
7    
8  #include <fnmatch.h>  #include <fnmatch.h>
9  #include <stdlib.h>  #include "libbb.h"
10  #include "unarchive.h"  #include "unarchive.h"
11    
12  /* Find a string in a shell pattern list */  /* Find a string in a shell pattern list */
13  const llist_t *find_list_entry(const llist_t *list, const char *filename)  const llist_t* FAST_FUNC find_list_entry(const llist_t *list, const char *filename)
14  {  {
15   while (list) {   while (list) {
16   if (fnmatch(list->data, filename, 0) == 0) {   if (fnmatch(list->data, filename, 0) == 0) {
# Line 24  const llist_t *find_list_entry(const lli Line 24  const llist_t *find_list_entry(const lli
24  /* Same, but compares only path components present in pattern  /* Same, but compares only path components present in pattern
25   * (extra trailing path components in filename are assumed to match)   * (extra trailing path components in filename are assumed to match)
26   */   */
27  const llist_t *find_list_entry2(const llist_t *list, const char *filename)  const llist_t* FAST_FUNC find_list_entry2(const llist_t *list, const char *filename)
28  {  {
29   char buf[PATH_MAX];   char buf[PATH_MAX];
30   int pattern_slash_cnt;   int pattern_slash_cnt;
# Line 38  const llist_t *find_list_entry2(const ll Line 38  const llist_t *find_list_entry2(const ll
38   if (*c++ == '/') pattern_slash_cnt++;   if (*c++ == '/') pattern_slash_cnt++;
39   c = filename;   c = filename;
40   d = buf;   d = buf;
41   /* paranoia is better that buffer overflows */   /* paranoia is better than buffer overflows */
42   while (*c && d != buf + sizeof(buf)-1) {   while (*c && d != buf + sizeof(buf)-1) {
43   if (*c == '/' && --pattern_slash_cnt < 0)   if (*c == '/' && --pattern_slash_cnt < 0)
44   break;   break;

Legend:
Removed from v.815  
changed lines
  Added in v.816