From e5bbb68278fa786ca6fed7cb1135ea4606c03c25 Mon Sep 17 00:00:00 2001 From: Michael Hampton Date: Thu, 16 Jan 2003 21:16:23 +0000 Subject: [PATCH] * CtdlIPCGetMessages(): Fix message read failing on first attempt to read messages --- citadel/ChangeLog | 5 ++++- citadel/citadel_ipc.c | 2 +- citadel/messages.c | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 4a78156b7..97a26da02 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 601.114 2003/01/16 21:16:23 error + * CtdlIPCGetMessages(): Fix message read failing on first attempt to read + messages + Revision 601.113 2003/01/16 10:04:03 error * ENT0 command: changed post-as username from arg 4 to arg 5; 4 was already used as the message subject @@ -4402,4 +4406,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index 53c9f7f64..8b1eff722 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -434,7 +434,7 @@ int CtdlIPCGetMessages(CtdlIPC *ipc, enum MessageList which, int whicharg, if (ret / 100 != 1) return ret; count = 0; - *mret = (unsigned long *)malloc(sizeof(unsigned long)); + *mret = (unsigned long *)calloc(1, sizeof(unsigned long)); if (!*mret) return -1; while (bbb && strlen(bbb)) { diff --git a/citadel/messages.c b/citadel/messages.c index c02ceb4ec..e222b0012 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -1279,11 +1279,11 @@ void readmsgs(CtdlIPC *ipc, ; } - if (num_msgs == 0) { - if (c == 3) return; + if (num_msgs == 0) { /* TODO look at this later */ + if (c == LastMessages) return; scr_printf("*** There are no "); - if (c == 1) scr_printf("new "); - if (c == 2) scr_printf("old "); + if (c == NewMessages) scr_printf("new "); + if (c == OldMessages) scr_printf("old "); scr_printf("messages in this room.\n"); return; } -- 2.39.2