[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Mailutils branch, master, updated. release-2.2-692-g751aad9
From: |
Sergey Poznyakoff |
Subject: |
[SCM] GNU Mailutils branch, master, updated. release-2.2-692-g751aad9 |
Date: |
Sat, 06 Dec 2014 07:51:13 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=751aad904e7d642240de2106de95429f8c248ea7
The branch, master has been updated
via 751aad904e7d642240de2106de95429f8c248ea7 (commit)
from 89d93a75c4abec10b9cfe0041eaf654d00f0a0ee (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 751aad904e7d642240de2106de95429f8c248ea7
Author: Sergey Poznyakoff <address@hidden>
Date: Sat Dec 6 09:46:49 2014 +0200
Improve diagnostics in maildir
* libmailutils/mailbox/fsfolder.c: Fix debugging categories
* libproto/maildir/mbox.c (maildir_opendir)
(maildir_msg_finish_delivery)
(maildir_scan0): Log errors.
(maildir_flush,maildir_deliver_new): Return EACCES if the mailbox is
read-only.
-----------------------------------------------------------------------
Summary of changes:
libmailutils/mailbox/fsfolder.c | 6 +-
libproto/maildir/mbox.c | 81 +++++++++++++++++++++++++++++---------
2 files changed, 65 insertions(+), 22 deletions(-)
diff --git a/libmailutils/mailbox/fsfolder.c b/libmailutils/mailbox/fsfolder.c
index 7620bf0..ba92a40 100644
--- a/libmailutils/mailbox/fsfolder.c
+++ b/libmailutils/mailbox/fsfolder.c
@@ -222,7 +222,7 @@ list_helper (struct search_data *data, mu_record_t record,
dirp = opendir (dirname);
if (dirp == NULL)
{
- mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_ERROR,
+ mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_ERROR,
("list_helper cannot open directory %s: %s",
dirname, mu_strerror (errno)));
data->errcnt++;
@@ -276,7 +276,7 @@ list_helper (struct search_data *data, mu_record_t record,
resp = malloc (sizeof (*resp));
if (resp == NULL)
{
- mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_ERROR,
+ mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_ERROR,
("list_helper: %s", mu_strerror (ENOMEM)));
data->errcnt++;
free (fname);
@@ -343,7 +343,7 @@ list_helper (struct search_data *data, mu_record_t record,
}
else
{
- mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_ERROR,
+ mu_debug (MU_DEBCAT_FOLDER, MU_DEBUG_ERROR,
("list_helper cannot stat %s: %s",
fname, mu_strerror (errno)));
}
diff --git a/libproto/maildir/mbox.c b/libproto/maildir/mbox.c
index 58ab3a4..a11201e 100644
--- a/libproto/maildir/mbox.c
+++ b/libproto/maildir/mbox.c
@@ -390,7 +390,7 @@ maildir_delete_file (char *dirname, char *filename)
struct stat st;
char *name;
int rc;
-
+
rc = maildir_mkfilename (dirname, filename, NULL, &name);
if (rc)
{
@@ -412,21 +412,32 @@ maildir_delete_file (char *dirname, char *filename)
static int
maildir_opendir (DIR **dir, char *name, int permissions)
{
+ int rc = 0;
+
*dir = opendir (name);
if (!*dir)
{
if (errno == ENOENT)
{
if (mkdir (name, permissions))
- return errno;
+ {
+ rc = errno;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("can't create directory %s: %s",
+ name, mu_strerror (rc)));
+ return rc;
+ }
+
*dir = opendir (name);
- if (!*dir)
- return errno;
+ if (*dir)
+ return 0;
}
- else
- return errno;
+ rc = errno;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("can't open directory %s: %s",
+ name, mu_strerror (rc)));
}
- return 0;
+ return rc;
}
static int
@@ -529,11 +540,28 @@ maildir_msg_finish_delivery (struct _amd_data *amd,
struct _amd_message *amm,
if (rc == 0)
{
- unlink (newname);
- if (link (oldname, newname) == 0)
- unlink (oldname);
+ if (unlink (newname))
+ {
+ rc = errno;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("can't unlink %s: %s",
+ newname, mu_strerror (errno)));
+ }
+ else if (link (oldname, newname) == 0)
+ {
+ if (unlink (oldname))
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("can't unlink %s: %s",
+ oldname, mu_strerror (errno)));
+ }
else
- rc = errno; /* FIXME? */
+ {
+ rc = errno;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("renaming %s to %s failed: %s",
+ oldname, newname, mu_strerror (rc)));
+ }
+
}
free (oldname);
@@ -552,6 +580,9 @@ maildir_flush (struct _amd_data *amd)
struct dirent *entry;
char *tmpname;
+ if (!(amd->mailbox->flags & MU_STREAM_WRITE))
+ return EACCES;
+
rc = maildir_mkfilename (amd->name, TMPSUF, NULL, &tmpname);
if (rc)
return rc;
@@ -588,7 +619,10 @@ int
maildir_deliver_new (struct _amd_data *amd, DIR *dir)
{
struct dirent *entry;
+ int err = 0;
+ if (!(amd->mailbox->flags & MU_STREAM_WRITE))
+ return EACCES;
while ((entry = readdir (dir)))
{
char *oldname, *newname;
@@ -609,12 +643,18 @@ maildir_deliver_new (struct _amd_data *amd, DIR *dir)
free (oldname);
return rc;
}
- rename (oldname, newname); /* FIXME: Error code? */
+ if (rename (oldname, newname))
+ {
+ err = MU_ERR_FAILURE;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("renaming %s to %s failed: %s",
+ oldname, newname, mu_strerror (errno)));
+ }
free (oldname);
free (newname);
}
}
- return 0;
+ return err;
}
static int
@@ -635,8 +675,8 @@ maildir_scan_dir (struct _amd_data *amd, DIR *dir, char
*dirname)
break;
default:
- /* Message not found. Index pointd to the array cell where it
- would be placed */
+ /* Message not found. Index points to the array cell where it
+ would be placed */
msg = calloc (1, sizeof (*msg));
if (!msg)
{
@@ -702,9 +742,7 @@ maildir_scan0 (mu_mailbox_t mailbox, size_t msgno
MU_ARG_UNUSED,
mu_stream_flags_to_mode (mailbox->flags, 1));
if (status == 0)
{
- if (mailbox->flags & MU_STREAM_WRITE)
- maildir_deliver_new (amd, dir);
- else
+ if (maildir_deliver_new (amd, dir))
status = maildir_scan_dir (amd, dir, NEWSUF);
closedir (dir);
}
@@ -824,7 +862,12 @@ maildir_chattr_msg (struct _amd_message *amsg, int expunge)
if (!new_name)
{
if (unlink (mp->file_name))
- rc = errno;
+ {
+ rc = errno;
+ mu_debug (MU_DEBCAT_MAILBOX, MU_DEBUG_ERROR,
+ ("can't unlink %s: %s",
+ mp->file_name, mu_strerror (rc)));
+ }
}
else
{
hooks/post-receive
--
GNU Mailutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Mailutils branch, master, updated. release-2.2-692-g751aad9,
Sergey Poznyakoff <=