Mercurial > noffle
changeset 464:d9035d08fe51 noffle
[svn] * src/fetch.c: Log failed posting that we can't mail back to the sender
or where sending fails to <Noffle spool>/failed.posting.
author | bears |
---|---|
date | Wed, 23 Jul 2003 10:32:25 +0100 |
parents | 95697d7c97a1 |
children | b8065ab36244 |
files | ChangeLog src/fetch.c |
diffstat | 2 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <Noffle spool>/failed.posting. Wed Jun 25 2003 Jim Hague <jim.hague@acm.org>
--- 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 ) );