Changeset 10251


Ignore:
Timestamp:
Feb 21, 2010, 1:29:23 PM (12 years ago)
Author:
charles
Message:

(trunk daemon) #2943 "watch.c matches every file containing '.torrent'" -- fix copy/paste error reported by Longinus00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/watch.c

    r10249 r10251  
    112112        while (i < len) {
    113113            struct inotify_event * event = (struct inotify_event *) &buf[i];
    114             if( str_has_suffix( event->name, ".torrent" ) )
     114            const char * name = event->name;
     115            if( str_has_suffix( name, ".torrent" ) )
    115116            {
    116                 tr_inf( "Found new .torrent file \"%s\" in watchdir \"%s\"", event->name, w->dir );
    117                 w->callback( w->session, w->dir, event->name );
     117                tr_inf( "Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir );
     118                w->callback( w->session, w->dir, name );
    118119            }
    119120            i += EVENT_SIZE +  event->len;
     
    180181        {
    181182            size_t len;
    182 
    183             if( !d->d_name || *d->d_name=='.' ) /* skip dotfiles */
     183            const char * name = d->d_name;
     184
     185            if( !name || *name=='.' ) /* skip dotfiles */
    184186                continue;
    185             if( !str_has_suffix( event->name, ".torrent" ) ) /* skip non-torrents */
     187            if( !str_has_suffix( name, ".torrent" ) ) /* skip non-torrents */
    186188                continue;
    187189
    188             len = strlen( d->d_name );
    189             add_file_to_list( curFiles, d->d_name, len );
     190            len = strlen( name );
     191            add_file_to_list( curFiles, name, len );
    190192
    191193            /* if this file wasn't here last time, try adding it */
    192             if( !is_file_in_list( w->lastFiles, d->d_name, len ) ) {
    193                 tr_inf( "Found new .torrent file \"%s\" in watchdir \"%s\"", d->d_name, w->dir );
    194                 w->callback( w->session, w->dir, d->d_name );
     194            if( !is_file_in_list( w->lastFiles, name, len ) ) {
     195                tr_inf( "Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir );
     196                w->callback( w->session, w->dir, name );
    195197            }
    196198        }
Note: See TracChangeset for help on using the changeset viewer.