Check the return value of the locker_t.
Showing
1 changed file
with
10 additions
and
5 deletions
... | @@ -389,9 +389,9 @@ mbox_open (mailbox_t mailbox, int flags) | ... | @@ -389,9 +389,9 @@ mbox_open (mailbox_t mailbox, int flags) |
389 | /* Give an appropriate way to file lock. */ | 389 | /* Give an appropriate way to file lock. */ |
390 | /* FIXME: use dotlock external program: we may not be setgid. */ | 390 | /* FIXME: use dotlock external program: we may not be setgid. */ |
391 | if (mailbox->locker == NULL) | 391 | if (mailbox->locker == NULL) |
392 | locker_create (&(mailbox->locker), mud->name, strlen (mud->name), | 392 | status = locker_create (&(mailbox->locker), mud->name, strlen (mud->name), |
393 | MU_LOCKER_PID | MU_LOCKER_FCNTL); | 393 | MU_LOCKER_PID | MU_LOCKER_FCNTL); |
394 | return 0; | 394 | return status; |
395 | } | 395 | } |
396 | 396 | ||
397 | static int | 397 | static int |
... | @@ -645,7 +645,7 @@ mbox_expunge (mailbox_t mailbox) | ... | @@ -645,7 +645,7 @@ mbox_expunge (mailbox_t mailbox) |
645 | } | 645 | } |
646 | 646 | ||
647 | /* Get the File lock. */ | 647 | /* Get the File lock. */ |
648 | if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) < 0) | 648 | if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) != 0) |
649 | { | 649 | { |
650 | mailbox_close (tmpmailbox); | 650 | mailbox_close (tmpmailbox); |
651 | mailbox_destroy (&tmpmailbox); | 651 | mailbox_destroy (&tmpmailbox); |
... | @@ -1374,7 +1374,12 @@ mbox_append_message (mailbox_t mailbox, message_t msg) | ... | @@ -1374,7 +1374,12 @@ mbox_append_message (mailbox_t mailbox, message_t msg) |
1374 | switch (mud->state) | 1374 | switch (mud->state) |
1375 | { | 1375 | { |
1376 | case MBOX_NO_STATE: | 1376 | case MBOX_NO_STATE: |
1377 | locker_lock (mailbox->locker, MU_LOCKER_WRLOCK); | 1377 | if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) != 0) |
1378 | { | ||
1379 | MAILBOX_DEBUG0 (mailbox, MU_DEBUG_TRACE, | ||
1380 | "mbox_append_message:lock failed\n"); | ||
1381 | return ENOLCK; | ||
1382 | } | ||
1378 | 1383 | ||
1379 | default: | 1384 | default: |
1380 | { | 1385 | { | ... | ... |
-
Please register or sign in to post a comment