Commit ce3fd630 ce3fd630f534ad8c93d912368e4512b671ae3207 by Sergey Poznyakoff

(deliver_pending_bulletins): Return immediately, if unable to count messages in the bulletin box

1 parent 397905e7
......@@ -151,7 +151,7 @@ read_bulletin_db (size_t *pnum)
return 1;
}
s = MU_DATUM_SIZE(data);
s = MU_DATUM_SIZE (data);
if (s < sizeof sbuf)
bufptr = sbuf;
else
......@@ -165,7 +165,7 @@ read_bulletin_db (size_t *pnum)
bufptr = buf;
}
memcpy (bufptr, MU_DATUM_PTR(data), s);
memcpy (bufptr, MU_DATUM_PTR (data), s);
bufptr[s] = 0;
mu_dbm_datum_free(&data);
......@@ -180,7 +180,7 @@ read_bulletin_db (size_t *pnum)
{
long n;
n = *(long*)MU_DATUM_PTR(data);
n = *(long*)MU_DATUM_PTR (data);
if (n >= 0)
{
syslog (LOG_INFO,
......@@ -220,11 +220,11 @@ write_bulletin_db (size_t num)
memset (&key, 0, sizeof key);
memset (&data, 0, sizeof data);
MU_DATUM_PTR(key) = username;
MU_DATUM_SIZE(key) = strlen (username);
MU_DATUM_PTR (key) = username;
MU_DATUM_SIZE (key) = strlen (username);
p = mu_umaxtostr (0, num);
MU_DATUM_PTR(data) = p;
MU_DATUM_SIZE(data) = strlen (p);
MU_DATUM_PTR (data) = p;
MU_DATUM_SIZE (data) = strlen (p);
rc = mu_dbm_insert (db, key, data, 1);
if (rc)
......@@ -274,8 +274,11 @@ deliver_pending_bulletins ()
return;
lastnum = get_last_delivered_num ();
mu_mailbox_messages_count (bull, &total);
rc = mu_mailbox_messages_count (bull, &total);
if (rc)
mu_error (_("Cannot count bulletins: %s"), mu_strerror (rc));
else
{
syslog (LOG_DEBUG,
"user %s, last bulletin %lu, total bulletins %lu",
username, (unsigned long) lastnum, (unsigned long) total);
......@@ -312,6 +315,8 @@ deliver_pending_bulletins ()
}
store_last_delivered_num (i - 1);
}
}
close_bulletin_mailbox (&bull);
}
......