# HG changeset patch # User enz # Date 964256660 -3600 # Node ID cfad9678e286b23a120cc7bc53a21ffa8a28cfa9 # Parent ec190bad201bb8ba2078fc9bd4433f1af113a20f [svn] Applied patch from M.Nalis: Modify Req_add() to append to requested/news.serv.er file each MsgID (and do not clean dirty flag, because otherwise writeRequestfile() would nuke us when overwriting file!). diff -r ec190bad201b -r cfad9678e286 ChangeLog --- a/ChangeLog Sat Jul 22 07:21:11 2000 +0100 +++ b/ChangeLog Sat Jul 22 10:04:20 2000 +0100 @@ -2,6 +2,13 @@ NOFFLE ChangeLog ------------------------------------------------------------------------------- +Sat Jul 22 2000 Markus Enzenberger + + * request.c: Applied patch from M.Nalis: + Modify Req_add() to append to requested/news.serv.er file each MsgID (and + do not clean dirty flag, because otherwise writeRequestfile() would nuke us + when overwriting file!). + Wed Jul 19 2000 Markus Enzenberger * Applied patch from M.Nalis for fixing a small problem with diff -r ec190bad201b -r cfad9678e286 src/request.c --- a/src/request.c Sat Jul 22 07:21:11 2000 +0100 +++ b/src/request.c Sat Jul 22 10:04:20 2000 +0100 @@ -3,7 +3,7 @@ Collection of articles that are marked for download. - $Id: request.c 60 2000-05-09 22:28:38Z uh1763 $ + $Id: request.c 178 2000-07-22 09:04:20Z enz $ */ #if HAVE_CONFIG_H @@ -65,7 +65,7 @@ static Bool getReqserv (const char* serv, Reqserv** rsz); static void fileRequest (Str file, const char *serv); static char** searchMsgId (const Reqserv * rs, const char *msgId); -static void storeMsgId (Reqserv* rs, const char* msgId); +static Bool storeMsgId (Reqserv* rs, const char* msgId); static Bool readRequestfile (const char* serv, Reqserv** rsz); static time_t get_mtime (const char* serv); @@ -178,13 +178,13 @@ } -static void storeMsgId(Reqserv* rs, const char* msgId) +static Bool storeMsgId(Reqserv* rs, const char* msgId) { char* msgid; if (searchMsgId(rs, msgId)) /* already recorded */ - return; + return FALSE; msgid = strcpy(malloc(strlen(msgId)+1), msgId); @@ -196,6 +196,34 @@ *(rs->reql + rs->reql_length++) = msgid; rs->dirty = TRUE; + return TRUE; +} + +static Bool +appRequest (Reqserv* rs, const char *msgId) +{ + Str filename; + FILE* file; + + fileRequest(filename, rs->serv); + Log_dbg("appending to request file %s", filename); + + if (Log_check((file = fopen(filename, "a")) != 0, + "could not open %s for appending: %s", + filename, strerror(errno))) + return FALSE; + + if (Log_check( fputs(msgId, file) != EOF + && fputs("\n", file) != EOF, + "write error: %s", strerror(errno))) + return FALSE; + + if (Log_check(fclose(file) != EOF, + "could not close %s properly: %s\n", + filename, strerror(errno))) + return FALSE; + + return TRUE; } @@ -210,8 +238,9 @@ if (getReqserv(serv, &rs) == FALSE) return FALSE; - storeMsgId(rs, msgId); + if (storeMsgId(rs, msgId) == FALSE) /* already recorded */ return TRUE; + return appRequest(rs, msgId); } static Bool