Commit 5f796a9c 5f796a9c31d4ab9c281af3a072ae4d150fd2a1fb by Sergey Poznyakoff

Reorganize error codes.

* libmailutils/diag/errors (MU_ERR_TCP_NO_HOST)
(MU_ERR_TCP_NO_PORT): Change wording.
(MU_ERR_UNSAFE_PERMS): Remove error code.
(MU_ERR_NO_HANDLER): Remove. All uses replaced by ENOSYS.
(MU_ERR_OUT_NULL): Remove. MU_ERR_OUT_PTR_NULL is used instead.
(MU_ERR_MBX_NULL): Remove. Use EINVAL instead.
(MU_ERR_BAD_822_FORMAT): Rename to MU_ERR_INVALID_EMAIL. Change wording.
(MU_ERR_REPLY): Change wording.

* libmailutils/url/create.c: Remove misguiding comments
* libmailutils/url/set-service.c: Likewise.

* libmailutils/mailbox/mailbox.c (mu_mailbox_open): Return EACCES
if trying to update quick-access mailboxes.
(mu_mailbox_get_stream): Mark for deletion.
* libmailutils/stream/fltstream.c (filter_read)
(filter_write_internal): Return MU_ERR_BUFSPACE if requested more
space than available in I/O buffers.
* libproto/mbox/mbox.c (mbox_expunge_unlocked): Send MU_EVT_MAILBOX_CORRUPT
event if the mailbox shrunk.
* libproto/mbox/mboxscan.c (mbox_scan_internal): Return MU_ERR_NOENT if
unable to locate message in quick-access mode.
1 parent fb994e0a
......@@ -97,7 +97,7 @@ actually help.
#endif
#define EOK 0
#define EPARSE MU_ERR_BAD_822_FORMAT
#define EPARSE MU_ERR_INVALID_EMAIL
/*
* Some convenience functions for dealing with dynamically re-sized
......
......@@ -409,7 +409,7 @@ amd_init_mailbox (mu_mailbox_t mailbox, size_t amd_size,
struct _amd_data *amd;
if (mailbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (amd_size < sizeof (*amd))
return EINVAL;
......@@ -533,7 +533,7 @@ amd_close (mu_mailbox_t mailbox)
int i;
if (!mailbox)
return MU_ERR_MBX_NULL;
return EINVAL;
amd = mailbox->data;
......@@ -1018,9 +1018,7 @@ amd_append_message (mu_mailbox_t mailbox, mu_message_t msg)
struct _amd_data *amd = mailbox->data;
struct _amd_message *mhm;
if (!mailbox)
return MU_ERR_MBX_NULL;
if (!msg)
if (!mailbox || !msg)
return EINVAL;
mhm = calloc (1, amd->msg_size);
......
# Error messages for GNU Mailutils
# Copyright (C) 2005, 2006, 2007, 2010, 2011 Free Software Foundation,
# Inc.
......@@ -19,20 +18,20 @@
MU_ERR_FAILURE _("Operation failed")
MU_ERR_CANCELED _("Operation canceled")
MU_ERR_NO_HANDLER _("No registered handler")
MU_ERR_EMPTY_VFN _("Empty virtual function")
MU_ERR_OUT_NULL _("Pointer to output null")
MU_ERR_OUT_PTR_NULL _("Pointer to output pointer null")
# A counterpart of EINVAL. Functions receiving invalid input arguments
# return EINVAL, those receiving invalid output arguments return this
# code:
MU_ERR_OUT_PTR_NULL _("Null output pointer")
MU_ERR_MBX_NULL _("Mailbox null")
MU_ERR_MBX_REMOVED _("Mailbox removed")
MU_ERR_NOT_OPEN _("Resource not open")
MU_ERR_OPEN _("Resource is already open")
MU_ERR_BAD_822_FORMAT _("Format of RFC822 object is bad")
MU_ERR_EMPTY_ADDRESS _("Address contains no addr specs")
MU_ERR_INVALID_EMAIL _("Malformed email address")
MU_ERR_EMPTY_ADDRESS _("Empty address list")
MU_ERR_LOCKER_NULL _("Locker null")
MU_ERR_LOCK_CONFLICT _("Conflict with previous locker")
......@@ -47,13 +46,14 @@ MU_ERR_NO_SUCH_USER _("No such user name")
MU_ERR_GETHOSTBYNAME _("DNS name resolution failed")
MU_ERR_BAD_RESUMPTION _("State busy must resume operation")
MU_ERR_MAILER_BAD_FROM _("Not a valid mailer from address")
MU_ERR_MAILER_BAD_TO _("Not a valid mailer to address")
MU_ERR_MAILER_NO_RCPT_TO _("No receipt addresses found")
MU_ERR_MAILER_BAD_FROM _("Not a valid sender address")
MU_ERR_MAILER_BAD_TO _("Not a valid recipient address")
MU_ERR_MAILER_NO_RCPT_TO _("No recipient addresses found")
MU_ERR_MAILER_BAD_URL _("Malformed or unsupported mailer URL")
MU_ERR_SMTP_RCPT_FAILED _("SMTP rcpt to command failed")
MU_ERR_TCP_NO_HOST _("Tcp connections need a host")
MU_ERR_TCP_NO_PORT _("Tcp connections need a positive port")
MU_ERR_SMTP_RCPT_FAILED _("SMTP RCPT command failed")
MU_ERR_TCP_NO_HOST _("Required host specification is missing")
MU_ERR_TCP_NO_PORT _("Invalid port or service specification")
MU_ERR_BAD_2047_INPUT _("Input string is not RFC 2047 encoded")
MU_ERR_BAD_2047_ENCODING _("Not a valid RFC 2047 encoding")
......@@ -63,7 +63,7 @@ MU_ERR_NOPASSWORD _("User password is not supplied")
MU_ERR_BADREPLY _("Invalid reply from the remote host")
MU_ERR_SEQ _("Bad command sequence")
MU_ERR_REPLY _("Erroneous reply received")
MU_ERR_REPLY _("Operation rejected by remote party")
MU_ERR_BAD_AUTH_SCHEME _("Unsupported authentication scheme")
MU_ERR_AUTH_FAILURE _("Authentication failed")
......@@ -78,6 +78,7 @@ MU_ERR_NOENT _("Requested item not found")
MU_ERR_EXISTS _("Item already exists")
MU_ERR_BUFSPACE _("Not enough buffer space")
# Database errors
MU_ERR_SQL _("SQL error")
MU_ERR_DB_ALREADY_CONNECTED _("Already connected to the database")
MU_ERR_DB_NOT_CONNECTED _("Not connected to the database")
......@@ -94,9 +95,15 @@ MU_ERR_READ _("Read error")
MU_ERR_NO_TRANSPORT _("Transport stream not set")
MU_ERR_AUTH_NO_CRED _("No credentials supplied")
# URL-related errors
MU_ERR_URL_MISS_PARTS _("URL missing required parts")
MU_ERR_URL_EXTRA_PARTS _("URL has parts not allowed by its scheme")
MU_ERR_URL_INVALID_PARAMETER _("Invalid parameter in URL")
# This error is returned when the requested data cannot be obtained right
# now or by the given means, or obtaining them is too costly, e.g. as
# obtaining number of lines in a message via POP3 (which would involve
# downloading entire message) by mu_message_quick_lines.
MU_ERR_INFO_UNAVAILABLE _("Information is not yet available")
# The following are mapped to the corresponding EAI_ errors
......@@ -106,7 +113,7 @@ MU_ERR_SOCKTYPE _("Socket type not supported")
MU_ERR_FAMILY _("Address family not supported")
MU_ERR_SERVICE _("Requested service not supported")
# File safety check
# File safety checks
MU_ERR_PERM_OWNER_MISMATCH _("File owner mismatch")
MU_ERR_PERM_GROUP_WRITABLE _("Group writable file")
MU_ERR_PERM_WORLD_WRITABLE _("World writable file")
......@@ -116,5 +123,3 @@ MU_ERR_PERM_LINKED_WRDIR _("Linked file in a writable directory")
MU_ERR_PERM_DIR_IWGRP _("File in group writable directory")
MU_ERR_PERM_DIR_IWOTH _("File in world writable directory")
# A simpler version of the above. Possibly will be removed in the future.
MU_ERR_UNSAFE_PERMS _("Unsafe file permissions")
......
......@@ -145,7 +145,7 @@ _mailbox_create_from_record (mu_mailbox_t *pmbox,
*pmbox = mbox;
return status;
}
return MU_ERR_NO_HANDLER;
return ENOSYS;
}
static int
......@@ -156,7 +156,7 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
if (mu_registrar_lookup_url (url, MU_FOLDER_ATTRIBUTE_FILE, &record, NULL)
== 0)
return _mailbox_create_from_record (pmbox, record, url, name);
return MU_ERR_NO_HANDLER;
return ENOSYS;
}
static int
......@@ -268,7 +268,7 @@ mu_mailbox_open (mu_mailbox_t mbox, int flag)
int rc;
if (!mbox)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->_open == NULL)
return MU_ERR_EMPTY_VFN;
if (mbox->flags & _MU_MAILBOX_OPEN)
......@@ -278,7 +278,7 @@ mu_mailbox_open (mu_mailbox_t mbox, int flag)
/* Quick access mailboxes are read-only */
if (flag & (MU_STREAM_WRITE
| MU_STREAM_APPEND | MU_STREAM_CREAT))
return EINVAL; /* FIXME: Better error code, please? */
return EACCES;
}
rc = mbox->_open (mbox, flag);
if (rc == 0)
......@@ -292,7 +292,7 @@ mu_mailbox_close (mu_mailbox_t mbox)
int rc;
if (!mbox)
return MU_ERR_MBX_NULL;
return EINVAL;
if (!(mbox->flags & _MU_MAILBOX_OPEN))
return MU_ERR_NOT_OPEN;
if (mbox == NULL || mbox->_close == NULL)
......@@ -308,7 +308,7 @@ int
mu_mailbox_remove (mu_mailbox_t mbox)
{
if (!mbox)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->flags & _MU_MAILBOX_OPEN)
return MU_ERR_OPEN;
if (mbox->flags & _MU_MAILBOX_REMOVED)
......@@ -325,7 +325,7 @@ mu_mailbox_flush (mu_mailbox_t mbox, int expunge)
int status = 0;
if (!mbox)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->flags & _MU_MAILBOX_REMOVED)
return MU_ERR_MBX_REMOVED;
if (!(mbox->flags & _MU_MAILBOX_OPEN))
......@@ -354,7 +354,7 @@ mu_mailbox_flush (mu_mailbox_t mbox, int expunge)
#define _MBOX_CHECK_FLAGS(mbox) \
if (mbox == NULL) \
return MU_ERR_MBX_NULL; \
return EINVAL; \
if (mbox->flags & _MU_MAILBOX_REMOVED) \
return MU_ERR_MBX_REMOVED; \
if (!(mbox->flags & _MU_MAILBOX_OPEN)) \
......@@ -517,7 +517,7 @@ int
mu_mailbox_set_locker (mu_mailbox_t mbox, mu_locker_t locker)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->locker)
mu_locker_destroy (&mbox->locker);
mbox->locker = locker;
......@@ -528,7 +528,7 @@ int
mu_mailbox_get_locker (mu_mailbox_t mbox, mu_locker_t *plocker)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (plocker == NULL)
return MU_ERR_OUT_PTR_NULL;
*plocker = mbox->locker;
......@@ -539,9 +539,9 @@ int
mu_mailbox_get_flags (mu_mailbox_t mbox, int *flags)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
if (!*flags)
return MU_ERR_OUT_NULL;
return EINVAL;
if (!flags)
return MU_ERR_OUT_PTR_NULL;
*flags = mbox->flags & ~_MU_MAILBOX_MASK;
return 0;
}
......@@ -550,7 +550,7 @@ int
mu_mailbox_set_stream (mu_mailbox_t mbox, mu_stream_t stream)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
if (mbox->stream)
......@@ -560,19 +560,20 @@ mu_mailbox_set_stream (mu_mailbox_t mbox, mu_stream_t stream)
}
/* FIXME: This is a problem. We provide a mu_mailbox_get_stream ()
and this stream is special it should, in theory, represent
a "view" of a flow of messages. But providing this perspective
may make sense for local mailboxes but downright impossible
for a remote mailbox, short on downloading the entire mailbox
and this stream is special: it should, in theory, represent
a "view" of a flow of messages. However, providing this perspective
may make sense for local mailboxes, but downright impossible
for remote mailboxes, short on downloading entire mailbox
locally.
The question is : should this function be removed?
So far it as been used on local mailboxes to get offsets. */
This function will be removed in the short run. It is no longer
used by MU. */
int
mu_mailbox_get_stream (mu_mailbox_t mbox, mu_stream_t *pstream)
{
/* FIXME: Deprecation warning */
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
......@@ -592,7 +593,7 @@ int
mu_mailbox_get_streamref (mu_mailbox_t mbox, mu_stream_t *pstream)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
......@@ -611,7 +612,7 @@ int
mu_mailbox_get_observable (mu_mailbox_t mbox, mu_observable_t *pobservable)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (pobservable == NULL)
return MU_ERR_OUT_PTR_NULL;
......@@ -629,7 +630,7 @@ int
mu_mailbox_set_property (mu_mailbox_t mbox, mu_property_t property)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mbox->property)
mu_property_unref (mbox->property);
mbox->property = property;
......@@ -641,7 +642,7 @@ int
mu_mailbox_get_property (mu_mailbox_t mbox, mu_property_t *pproperty)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (pproperty == NULL)
return MU_ERR_OUT_PTR_NULL;
......@@ -665,7 +666,7 @@ int
mu_mailbox_get_url (mu_mailbox_t mbox, mu_url_t *purl)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (purl == NULL)
return MU_ERR_OUT_PTR_NULL;
*purl = mbox->url;
......@@ -676,7 +677,7 @@ int
mu_mailbox_get_folder (mu_mailbox_t mbox, mu_folder_t *pfolder)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
if (pfolder == NULL)
return MU_ERR_OUT_PTR_NULL;
*pfolder = mbox->folder;
......@@ -687,7 +688,7 @@ int
mu_mailbox_set_folder (mu_mailbox_t mbox, mu_folder_t folder)
{
if (mbox == NULL)
return MU_ERR_MBX_NULL;
return EINVAL;
mbox->folder = folder;
return 0;
}
......@@ -715,9 +716,9 @@ mu_mailbox_get_uidls (mu_mailbox_t mbox, mu_list_t *plist)
int status;
if (mbox == NULL)
return MU_ERR_MBX_NULL;
if (plist == NULL)
return EINVAL;
if (plist == NULL)
return MU_ERR_OUT_PTR_NULL;
status = mu_list_create (&list);
if (status)
return status;
......@@ -847,9 +848,9 @@ mu_mailbox_translate (mu_mailbox_t mbox, int cmd, size_t from, size_t *to)
mu_message_t msg;
if (mbox == NULL)
return MU_ERR_MBX_NULL;
if (to == NULL)
return EINVAL;
if (to == NULL)
return MU_ERR_OUT_PTR_NULL;
if (mbox->flags & MU_STREAM_QACCESS)
return MU_ERR_BADOP;
......
......@@ -372,7 +372,7 @@ safe_address_create (mu_address_t *paddr, const char *addr_str,
const char *who)
{
int status = mu_address_create (paddr, addr_str);
if (status == MU_ERR_BAD_822_FORMAT)
if (status == MU_ERR_INVALID_EMAIL)
{
int rc;
char *p;
......@@ -394,7 +394,7 @@ safe_address_create (mu_address_t *paddr, const char *addr_str,
rc = mu_address_create (paddr, p);
if (rc == 0)
status = 0;
else if (rc == MU_ERR_BAD_822_FORMAT)
else if (rc == MU_ERR_INVALID_EMAIL)
mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_TRACE1,
("%s address guess failed", who));
else
......
......@@ -197,7 +197,7 @@ filter_read (mu_stream_t stream, char *buf, size_t size, size_t *pret)
if (iobuf.isize > MFB_RDBYTES (fs->inbuf)
|| iobuf.osize > MFB_FREESIZE (fs->outbuf))
return MU_ERR_FAILURE; /* FIXME: special error code? */
return MU_ERR_BUFSPACE;
/* iobuf.osize contains number of bytes written to output */
MFB_advance_level (&fs->outbuf, iobuf.osize);
......@@ -334,7 +334,7 @@ filter_write_internal (mu_stream_t stream, enum mu_filter_command cmd,
if (iobuf.isize > MFB_RDBYTES (fs->inbuf)
|| iobuf.osize > MFB_FREESIZE (fs->outbuf))
return MU_ERR_FAILURE; /* FIXME: special error code? */
return MU_ERR_BUFSPACE;
/* iobuf.osize contains number of bytes written to output */
MFB_advance_level (&fs->outbuf, iobuf.osize);
......
......@@ -230,7 +230,7 @@ _message_open (mu_stream_t stream)
offset += len;
continue;
}
return MU_ERR_BAD_822_FORMAT;
return MU_ERR_INVALID_EMAIL;
}
has_headers = 1;
if (!env_from || !env_date)
......
......@@ -34,7 +34,7 @@ AT_CLEANUP
TESTADDR([Sam <@[matrix (smtp)], @[nexus: [node 12]]:sroberts@[10].[1]>],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([a@b,z@y],[],
......@@ -226,7 +226,7 @@ TESTADDR([a group: ,, ;],[group],
TESTADDR([Sam <@[matrix (smtp)], @[nexus: [node 12]]:sroberts@[10].[1]> ;],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([Aliens: Sam <@[matrix (smtp)]: sam@sam>, sroberts@[10].[1];],[],
......@@ -296,7 +296,7 @@ route <@mail2.uniserve.com>
TESTADDR([< (hey) @ (hey, )smtp1.sympatico.ca, mail2.uniserve.com (hoo!):sroberts@uniserve.com>],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([hw@570.com (Hardware Support Account)],[],
......@@ -374,7 +374,7 @@ local-part <paul> domain <pitbull-productions.com>
TESTADDR(["'sam@cogent.ca'" <sam@cogent.ca>, "'sroberts@uniserve.com'"],[],
[0],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR(["'sroberts\@certicom\.ca'" <sroberts@certicom.ca>],[],
......@@ -603,7 +603,7 @@ local-part <zwk%f36.n480.z2.fidonet.org> domain <f36.n480.z2.fidonet.org>
TESTADDR(['Dan Dall'Acqua' <ddallacqua@noetic.ab.ca>, 'Dave Shyong'],[],
[0],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([0xdeadbeef-request@petting-zoo.net],[],
......@@ -657,7 +657,7 @@ local-part <Nick_Shelness> domain <motorcity2.lotus.com>
TESTADDR([<all: >],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([<fyi-admin@emyr.net>],[],
......@@ -1008,7 +1008,7 @@ local-part <Kieran.O'Leary> domain <anpost.ie>
TESTADDR([rfunk@wks.uts.ohio-state.eduofflinemailer-bounce@dikke.penguin.nl],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([root],[],
......@@ -1021,7 +1021,7 @@ local-part <root> domain <localhost>
TESTADDR([whom it may concern: ;;whom.it.may.concern: ;],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
TESTADDR([whom it may concern: mutt-dev@mutt.org, mutt-users@mutt.org;],[],
......@@ -1052,7 +1052,7 @@ local-part <bach> domain <somewhere.org>
TESTADDR(["A bad quote\" <devnull@localhost>],[],
[1],
[],
[MU_ERR_BAD_822_FORMAT
[MU_ERR_INVALID_EMAIL
])
......
......@@ -476,7 +476,7 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
/* FIXME: Another proto? */
struct servent *sp = getservbyname (url->portstr, "tcp");
if (!sp)
return MU_ERR_TCP_NO_PORT; //FIXME: Error code?
return MU_ERR_TCP_NO_PORT;
url->port = ntohs (sp->s_port);
}
else
......
......@@ -53,7 +53,7 @@ mu_url_set_service (mu_url_t url, const char *str)
/* FIXME: 2. Another proto? */
struct servent *sp = getservbyname (str, "tcp");
if (!sp)
return MU_ERR_TCP_NO_PORT; /*FIXME: Error code?*/
return MU_ERR_TCP_NO_PORT;
port = ntohs (sp->s_port);
}
else if (n > USHRT_MAX)
......
......@@ -204,7 +204,7 @@ mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
}
}
else if (name[5])
return MU_ERR_URL_EXTRA_PARTS;//FIXME: better error code
return MU_ERR_URL_INVALID_PARAMETER;
}
else if (strcmp (name, "none") == 0)
{
......@@ -221,7 +221,7 @@ mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
val = DEFAULT_DBM_SAFETY_FLAGS;
}
else if (mu_file_safety_name_to_code (name, &val))
return MU_ERR_URL_EXTRA_PARTS;//FIXME: better error code
return MU_ERR_URL_INVALID_PARAMETER;
if (negate)
safety_flags &= ~val;
......
......@@ -128,7 +128,7 @@ _mailbox_imap_and_imaps_init (mu_mailbox_t mailbox, int imaps)
m_imap_t m_imap;
if (!mailbox)
return MU_ERR_MBX_NULL;
return EINVAL;
if (mailbox->folder == NULL)
return EINVAL;
......
......@@ -166,7 +166,7 @@ sendmail_send_message (mu_mailer_t mailer, mu_message_t msg, mu_address_t from,
mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_TRACE,
("envelope from (%s) not fully qualifed\n",
emailfrom));
return MU_ERR_BAD_822_FORMAT;
return MU_ERR_INVALID_EMAIL;
}
argc += 2; /* -f from */
......@@ -239,7 +239,7 @@ sendmail_send_message (mu_mailer_t mailer, mu_message_t msg, mu_address_t from,
("envelope to (%s) not fully qualifed",
email));
free (argvec);
return MU_ERR_BAD_822_FORMAT;
return MU_ERR_INVALID_EMAIL;
}
argvec[argc++] = email;
}
......
......@@ -1307,6 +1307,8 @@ mbox_expunge_unlocked (mu_mailbox_t mailbox, size_t dirty, int remove_deleted,
else if (size < mud->size)
{
/* Corrupted mailbox. */
mu_observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT,
mailbox);
mu_error (_("%s:%d: mailbox shrunk while expunging"),
__FILE__, __LINE__);
return MU_ERR_FAILURE; /* FIXME: need an error code for that */
......
......@@ -346,7 +346,7 @@ mbox_scan_internal (mu_mailbox_t mailbox, mbox_message_t mum,
{
/* In one-message mode, the positioning should be exact. */
if (!isfrom)
return EINVAL; /* FIXME: Better error code, please? */
return MU_ERR_NOENT;
}
/* Which part of the message are we in ? */
......
......@@ -34,7 +34,7 @@ mu_pop3_list (mu_pop3_t pop3, unsigned int msgno, size_t *psize)
if (pop3 == NULL || msgno == 0)
return EINVAL;
if (psize == NULL)
return MU_ERR_OUT_NULL;
return MU_ERR_OUT_PTR_NULL;
switch (pop3->state)
{
......
......@@ -53,7 +53,7 @@ MU_ERR_EMPTY_VFN = (MU_ERR_BASE+3)
MU_ERR_OUT_NULL = (MU_ERR_BASE+4)
MU_ERR_OUT_PTR_NULL = (MU_ERR_BASE+5)
MU_ERR_MBX_NULL = (MU_ERR_BASE+6)
MU_ERR_BAD_822_FORMAT = (MU_ERR_BASE+7)
MU_ERR_INVALID_EMAIL = (MU_ERR_BASE+7)
MU_ERR_EMPTY_ADDRESS = (MU_ERR_BASE+8)
MU_ERR_LOCKER_NULL = (MU_ERR_BASE+9)
MU_ERR_LOCK_CONFLICT = (MU_ERR_BASE+10)
......