# HG changeset patch # User bears # Date 1058952745 -3600 # Node ID d9035d08fe51e9eb5c6a1b94f61b8e29e4fcc9e1 # Parent 95697d7c97a175f701a32434731922874d9d0766 [svn] * src/fetch.c: Log failed posting that we can't mail back to the sender or where sending fails to /failed.posting. diff -r 95697d7c97a1 -r d9035d08fe51 ChangeLog --- a/ChangeLog Wed Jul 23 10:31:01 2003 +0100 +++ b/ChangeLog Wed Jul 23 10:32:25 2003 +0100 @@ -3,6 +3,12 @@ * src/itemlist.c: Add define so test code builds again. * src/noffle.c: Fix SF bug 756585 in command handling and beef up returning an appropriate exit value. +* src/log.c: Rename log structure to logSettings to remove warning about + hiding built-in from GCC 3.3.1. +* src/outgoing.c,src/util.h,src/util.c: Create Utl_createDir() and + Utl_writeFile() and rework outgoing.c to use them. +* src/fetch.c: Log failed posting that we can't mail back to the sender + or where sending fails to /failed.posting. Wed Jun 25 2003 Jim Hague diff -r 95697d7c97a1 -r d9035d08fe51 src/fetch.c --- a/src/fetch.c Wed Jul 23 10:31:01 2003 +0100 +++ b/src/fetch.c Wed Jul 23 10:32:25 2003 +0100 @@ -1,7 +1,7 @@ /* fetch.c - $Id: fetch.c 415 2003-01-10 22:40:18Z bears $ + $Id: fetch.c 609 2003-07-23 09:32:25Z bears $ */ #if HAVE_CONFIG_H @@ -296,8 +296,15 @@ } static void +saveArticleInFailedPostings( const char *msgId, const char *article ) +{ + + Utl_writeFile( Cfg_spoolDir(), "failed.posting", msgId, article ); +} + +static void returnArticleToSender( const char *sender, const char *reason, - const char *article ) + const char *msgId, const char *article ) { int ret; Str cmd; @@ -309,7 +316,10 @@ lastHandler = signal( SIGPIPE, SIG_IGN ); f = popen( cmd, "w" ); if ( f == NULL ) + { Log_err( "Invocation of '%s' failed (%s)", cmd, strerror( errno ) ); + saveArticleInFailedPostings( msgId, article ); + } else { fprintf( f, @@ -331,7 +341,10 @@ reason, article ); ret = pclose( f ); if ( ret != EXIT_SUCCESS ) + { Log_err( "'%s' exit value %d", cmd, ret ); + saveArticleInFailedPostings( msgId, article ); + } signal( SIGPIPE, lastHandler ); } } @@ -372,10 +385,13 @@ && ! Prt_searchHeader( txt, "X-NOFFLE-X-SENDER", sender ) /* see server.c */ && ! Prt_searchHeader( txt, "FROM", sender ) ) + { Log_err( "Article %s has no From/Sender/X-Sender field", msgId ); + saveArticleInFailedPostings( msgId, txt ); + } else - returnArticleToSender( sender, errStr, txt ); + returnArticleToSender( sender, errStr, msgId, txt ); } } while ( Out_next( msgId, s ) );