Ticket #12291: 12291.patch

File 12291.patch, 3.7 KB (added by anevilyak, 9 years ago)
  • src/system/libroot/posix/fts.c

    diff --git a/src/system/libroot/posix/fts.c b/src/system/libroot/posix/fts.c
    index ce7ac95..0a68cbf 100644
    a b static int fts_stat(FTS *, FTSENT *, int);  
    8080static int   fts_safe_changedir(FTS *, FTSENT *, int, char *);
    8181static int   fts_ufslinks(FTS *, const FTSENT *);
    8282
     83
     84FTS * __fts_open(char * const *argv, int options, int (*compar)(
     85        const FTSENT * const *, const FTSENT * const *));
     86int __fts_close(FTS *sp);
     87FTSENT * __fts_read(FTS *sp);
     88int __fts_set(FTS *sp, FTSENT *p, int instr);
     89FTSENT * __fts_children(FTS *sp, int instr);
     90void *(__fts_get_clientptr)(FTS *sp);
     91FTS * (__fts_get_stream)(FTSENT *p);
     92void __fts_set_clientptr(FTS *sp, void *clientptr);
     93
     94
     95#undef weak_alias
     96#define weak_alias(name, aliasname) \
     97    extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
     98
    8399#define ISDOT(a)    (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
    84100
    85101#define CLR(opt)    (sp->fts_options &= ~(opt))
    static const char *ufslike_filesystems[] = {  
    128144#endif /* !__HAIKU__ */
    129145
    130146FTS *
    131 fts_open(argv, options, compar)
     147__fts_open(argv, options, compar)
    132148    char * const *argv;
    133149    int options;
    134150    int (*compar)(const FTSENT * const *, const FTSENT * const *);
    mem1: free(sp);  
    245261    return (NULL);
    246262}
    247263
     264
     265weak_alias (__fts_open, fts_open)
     266
     267
    248268static void
    249269fts_load(FTS *sp, FTSENT *p)
    250270{
    fts_load(FTS *sp, FTSENT *p)  
    270290}
    271291
    272292int
    273 fts_close(FTS *sp)
     293__fts_close(FTS *sp)
    274294{
    275295    FTSENT *freep, *p;
    276296    int saved_errno;
    fts_close(FTS *sp)  
    315335    return (0);
    316336}
    317337
     338
     339weak_alias (__fts_close, fts_close)
     340
     341
    318342/*
    319343 * Special case of "/" at the end of the path so that slashes aren't
    320344 * appended which would cause paths to be written as "....//foo".
    fts_close(FTS *sp)  
    324348        ? p->fts_pathlen - 1 : p->fts_pathlen)
    325349
    326350FTSENT *
    327 fts_read(FTS *sp)
     351__fts_read(FTS *sp)
    328352{
    329353    FTSENT *p, *tmp;
    330354    int instr;
    name: t = sp->fts_path + NAPPEND(p->fts_parent);  
    510534    return (sp->fts_cur = p);
    511535}
    512536
     537
     538weak_alias (__fts_read, fts_read)
     539
     540
    513541/*
    514542 * Fts_set takes the stream as an argument although it's not used in this
    515543 * implementation; it would be necessary if anyone wanted to add global
    name: t = sp->fts_path + NAPPEND(p->fts_parent);  
    518546 */
    519547/* ARGSUSED */
    520548int
    521 fts_set(FTS *sp, FTSENT *p, int instr)
     549__fts_set(FTS *sp, FTSENT *p, int instr)
    522550{
    523551    if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
    524552        instr != FTS_NOINSTR && instr != FTS_SKIP) {
    fts_set(FTS *sp, FTSENT *p, int instr)  
    529557    return (0);
    530558}
    531559
     560
     561weak_alias (__fts_set, fts_set)
     562
     563
    532564FTSENT *
    533 fts_children(FTS *sp, int instr)
     565__fts_children(FTS *sp, int instr)
    534566{
    535567    FTSENT *p;
    536568    int fd;
    fts_children(FTS *sp, int instr)  
    597629    return (sp->fts_child);
    598630}
    599631
     632
     633weak_alias (__fts_children, fts_children)
     634
     635
    600636#ifndef fts_get_clientptr
    601637#error "fts_get_clientptr not defined"
    602638#endif
    603639
    604640void *
    605 (fts_get_clientptr)(FTS *sp)
     641(__fts_get_clientptr)(FTS *sp)
    606642{
    607643
    608644    return (fts_get_clientptr(sp));
    609645}
    610646
     647
     648weak_alias (__fts_get_clientptr, fts_get_clientptr)
     649
     650
    611651#ifndef fts_get_stream
    612652#error "fts_get_stream not defined"
    613653#endif
    614654
    615655FTS *
    616 (fts_get_stream)(FTSENT *p)
     656(__fts_get_stream)(FTSENT *p)
    617657{
    618658    return (fts_get_stream(p));
    619659}
    620660
     661
     662weak_alias (__fts_get_stream, fts_get_stream)
     663
     664
    621665void
    622 fts_set_clientptr(FTS *sp, void *clientptr)
     666__fts_set_clientptr(FTS *sp, void *clientptr)
    623667{
    624668
    625669    sp->fts_clientptr = clientptr;
    626670}
    627671
     672
     673weak_alias (__fts_set_clientptr, fts_set_clientptr)
     674
     675
    628676/*
    629677 * This is the tricky part -- do not casually change *anything* in here.  The
    630678 * idea is to build the linked list of entries that are used by fts_children