# HG changeset patch # User bears # Date 1053591985 -3600 # Node ID 0137b5490cca7f2f33a928add145c45a3ada6954 # Parent 278a03a392b18f34afd9a247cd43c144ee220e8c [svn] * src/outgoing.c: Don't assume "." and ".." are the first files returned from readdir(). Thanks to Andreas Happe for spotting this. diff -r 278a03a392b1 -r 0137b5490cca src/outgoing.c --- a/src/outgoing.c Thu May 22 09:23:33 2003 +0100 +++ b/src/outgoing.c Thu May 22 09:26:25 2003 +0100 @@ -1,7 +1,7 @@ /* outgoing.c - $Id: outgoing.c 425 2003-01-30 15:49:23Z bears $ + $Id: outgoing.c 529 2003-05-22 08:26:25Z bears $ */ #if HAVE_CONFIG_H @@ -91,8 +91,6 @@ return FALSE; } Utl_cpyStr( outgoing.serv, serv ); - Out_next( NULL, NULL ); /* "." */ - Out_next( NULL, NULL ); /* ".." */ return Out_next( msgId, artTxt ); } @@ -104,12 +102,17 @@ Str file, line; ASSERT( outgoing.dir ); - if ( ! ( d = readdir( outgoing.dir ) ) ) - { - closedir( outgoing.dir ); - outgoing.dir = NULL; - return FALSE; - } + + do { + if ( ! ( d = readdir( outgoing.dir ) ) ) + { + closedir( outgoing.dir ); + outgoing.dir = NULL; + return FALSE; + } + } while ( strcmp( d->d_name, "." ) == 0 || + strcmp( d->d_name, ".." ) == 0 ); + if ( msgId != NULL ) Utl_cpyStr( msgId, d->d_name ); if ( artTxt == NULL ) @@ -153,15 +156,16 @@ return FALSE; } - readdir( d ); /* '.' */ - readdir( d ); /* '..' */ - res = FALSE; while ( ! res && ( entry = readdir( d ) ) != NULL ) { Str file; struct stat s; + if ( strcmp( entry->d_name, "." ) == 0 || + strcmp( entry->d_name, ".." ) == 0 ) + continue; + fileOutgoing( file, entry->d_name, msgId ); if ( stat( file, &s ) == 0 ) {