diff options
author | Alain Magloire <alainm@gnu.org> | 2001-04-17 03:31:19 +0000 |
---|---|---|
committer | Alain Magloire <alainm@gnu.org> | 2001-04-17 03:31:19 +0000 |
commit | a912fe08506332584c285c0b90246331b6707a35 (patch) | |
tree | 45a35a8e6affce9adfb408465f33f41dce4ef821 | |
parent | c8df06a75ca9559630d761a6745032c22d9beb58 (diff) | |
download | mailutils-a912fe08506332584c285c0b90246331b6707a35.tar.gz mailutils-a912fe08506332584c285c0b90246331b6707a35.tar.bz2 |
Check the return value of the locker_t.
-rw-r--r-- | mailbox/mbx_mbox.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/mailbox/mbx_mbox.c b/mailbox/mbx_mbox.c index ace9badc1..d8fd83f3e 100644 --- a/mailbox/mbx_mbox.c +++ b/mailbox/mbx_mbox.c @@ -389,9 +389,9 @@ mbox_open (mailbox_t mailbox, int flags) /* Give an appropriate way to file lock. */ /* FIXME: use dotlock external program: we may not be setgid. */ if (mailbox->locker == NULL) - locker_create (&(mailbox->locker), mud->name, strlen (mud->name), - MU_LOCKER_PID | MU_LOCKER_FCNTL); - return 0; + status = locker_create (&(mailbox->locker), mud->name, strlen (mud->name), + MU_LOCKER_PID | MU_LOCKER_FCNTL); + return status; } static int @@ -645,7 +645,7 @@ mbox_expunge (mailbox_t mailbox) } /* Get the File lock. */ - if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) < 0) + if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) != 0) { mailbox_close (tmpmailbox); mailbox_destroy (&tmpmailbox); @@ -1374,7 +1374,12 @@ mbox_append_message (mailbox_t mailbox, message_t msg) switch (mud->state) { case MBOX_NO_STATE: - locker_lock (mailbox->locker, MU_LOCKER_WRLOCK); + if (locker_lock (mailbox->locker, MU_LOCKER_WRLOCK) != 0) + { + MAILBOX_DEBUG0 (mailbox, MU_DEBUG_TRACE, + "mbox_append_message:lock failed\n"); + return ENOLCK; + } default: { |