]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_imap.c
* Trying to fix IMAP brokenness on Linux-x64. Committing changes even
[citadel.git] / citadel / serv_imap.c
index 3412eb638eb75b3862ef8f74b62f2c882dfc3332..65682eb3621833f6ba703b46efd099547af77b1f 100644 (file)
@@ -217,7 +217,11 @@ void imap_rescan_msgids(void)
        cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
        if (cdbfr != NULL) {
                msglist = malloc(cdbfr->len);
-               memcpy(msglist, cdbfr->ptr, cdbfr->len);
+               if (msglist == NULL) {
+                       lprintf(CTDL_CRIT, "malloc() failed\n");
+                       abort();
+               }
+               memcpy(msglist, cdbfr->ptr, (size_t)cdbfr->len);
                num_msgs = cdbfr->len / sizeof(long);
                cdb_free(cdbfr);
        } else {
@@ -602,7 +606,7 @@ int imap_do_expunge(void)
                imap_rescan_msgids();
        }
 
-       lprintf(9, "Expunged %d messages.\n", num_expunged);
+       lprintf(CTDL_DEBUG, "Expunged %d messages.\n", num_expunged);
        return (num_expunged);
 }
 
@@ -1253,7 +1257,7 @@ void imap_command_loop(void)
        char *parms[SIZ];
        int num_parms;
 
-       time(&CC->lastcmd);
+       CC->lastcmd = time(NULL);
        memset(cmdbuf, 0, sizeof cmdbuf);       /* Clear it, just in case */
        flush_output();
        if (client_gets(cmdbuf) < 1) {
@@ -1266,7 +1270,6 @@ void imap_command_loop(void)
        while (strlen(cmdbuf) < 5)
                strcat(cmdbuf, " ");
 
-
        /* strip off l/t whitespace and CRLF */
        if (cmdbuf[strlen(cmdbuf) - 1] == '\n')
                cmdbuf[strlen(cmdbuf) - 1] = 0;
@@ -1284,7 +1287,6 @@ void imap_command_loop(void)
                return;
        }
 
-
        /* Ok, at this point we're in normal command mode.  The first thing
         * we do is print any incoming pages (yeah! we really do!)
         */