Re: 441 error messages

Andreas Happe <[email protected]> Mon, 19 May 2003 17:53:24 +0200
Newsgroups gmane.network.noffle.user
Message-ID <[email protected]>
following - up to myself:
it seems that (with linux kernel 2.5) readdir doesn't returns '.' or
'..' as first directory entries.

the following patch should reanable posting with 2.5. It compiles, but
due to a error in the automake script i cannot test it. Another solution
would be a own readdir function, which would return the standard readdir
output, but would "overread" '.' and '..'.

--- outgoing.c	2003-05-19 17:50:55.000000000 +0200
+++ outgoing-2.c	2003-05-19 17:50:31.000000000 +0200
@@ -91,8 +91,9 @@
         return FALSE;
     }
     Utl_cpyStr( outgoing.serv, serv );
-    Out_next( NULL, NULL ); /* "."  */
-    Out_next( NULL, NULL ); /* ".." */
+    /* the order of '.' and '..' isn't fixed in linux 2.5 */
+//    Out_next( NULL, NULL ); /* "."  */
+//    Out_next( NULL, NULL ); /* ".." */
     return Out_next( msgId, artTxt );
 }
 
@@ -104,12 +105,14 @@
     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 );

HTH,
andreas



-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge