Bugfix
* libproto/mbox/mbox.c (mbox_append_message): Fix qid calculation.
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -1263,7 +1263,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) | ... | @@ -1263,7 +1263,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) |
1263 | { | 1263 | { |
1264 | int status = 0; | 1264 | int status = 0; |
1265 | mbox_data_t mud = mailbox->data; | 1265 | mbox_data_t mud = mailbox->data; |
1266 | mu_off_t size; | 1266 | mu_off_t qid; |
1267 | 1267 | ||
1268 | if (msg == NULL || mud == NULL) | 1268 | if (msg == NULL || mud == NULL) |
1269 | return EINVAL; | 1269 | return EINVAL; |
... | @@ -1284,9 +1284,11 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) | ... | @@ -1284,9 +1284,11 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) |
1284 | 1284 | ||
1285 | default: | 1285 | default: |
1286 | { | 1286 | { |
1287 | mu_off_t size; | ||
1287 | /* Move to the end of the file, not necesary if _APPEND mode. */ | 1288 | /* Move to the end of the file, not necesary if _APPEND mode. */ |
1288 | if ((status = mu_stream_size (mailbox->stream, &size)) != 0 | 1289 | if ((status = mu_stream_size (mailbox->stream, &size)) != 0 |
1289 | || (status = mbox_append_message0 (mailbox, msg, | 1290 | || (qid = size, |
1291 | status = mbox_append_message0 (mailbox, msg, | ||
1290 | &size, 0, 0)) != 0) | 1292 | &size, 0, 0)) != 0) |
1291 | { | 1293 | { |
1292 | if (status != EAGAIN) | 1294 | if (status != EAGAIN) |
... | @@ -1300,7 +1302,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) | ... | @@ -1300,7 +1302,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg) |
1300 | if (mailbox->observable) | 1302 | if (mailbox->observable) |
1301 | { | 1303 | { |
1302 | char *buf = NULL; | 1304 | char *buf = NULL; |
1303 | mu_asprintf (&buf, "%lu", (unsigned long) size); | 1305 | mu_asprintf (&buf, "%lu", (unsigned long) qid); |
1304 | mu_observable_notify (mailbox->observable, MU_EVT_MESSAGE_APPEND, buf); | 1306 | mu_observable_notify (mailbox->observable, MU_EVT_MESSAGE_APPEND, buf); |
1305 | free (buf); | 1307 | free (buf); |
1306 | } | 1308 | } | ... | ... |
-
Please register or sign in to post a comment