summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--maidag/deliver.c41
-rw-r--r--maidag/maidag.c4
-rw-r--r--maidag/maidag.h2
-rw-r--r--maidag/mailtmp.c23
-rw-r--r--maidag/util.c8
6 files changed, 47 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index 05516e183..27dc6ff7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-03-03 Sergey Poznyakoff <gray@gnu.org.ua>
+ * maidag/maidag.c (main): Fix autodetection of log_to_stderr.
+ * maidag/deliver.c, maidag/maidag.h, maidag/mailtmp.c: Rename
+ mailer_err to maidag_error.
+ * maidag/util.c (mailer_err): Rename to maidag_error. Print to
+ stderr only if log_to_stderr is set.
+
Fix bootstrapping with gettext 0.17.
* bootstrap.conf (avoided_gnulib_modules): Remove size_max
diff --git a/maidag/deliver.c b/maidag/deliver.c
index 0d39cd7b6..e7dd18e1c 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -1,6 +1,6 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2005,
- 2007 Free Software Foundation, Inc.
+ 2007, 2008 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -159,7 +159,8 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
status = mu_mailbox_open (mbox, MU_STREAM_APPEND|MU_STREAM_CREAT);
if (status != 0)
{
- mailer_err (_("Cannot open mailbox %s: %s"), path, mu_strerror (status));
+ maidag_error (_("Cannot open mailbox %s: %s"),
+ path, mu_strerror (status));
mu_mailbox_destroy (&mbox);
return EX_TEMPFAIL;
}
@@ -176,8 +177,8 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
if (status)
{
- mailer_err (_("Cannot lock mailbox `%s': %s"), path,
- mu_strerror (status));
+ maidag_error (_("Cannot lock mailbox `%s': %s"), path,
+ mu_strerror (status));
mu_mailbox_destroy (&mbox);
exit_code = EX_TEMPFAIL;
return EX_TEMPFAIL;
@@ -192,8 +193,8 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
if ((status = mu_mailbox_get_size (mbox, &mbsize)))
{
- mailer_err (_("Cannot get size of mailbox %s: %s"),
- path, mu_strerror (status));
+ maidag_error (_("Cannot get size of mailbox %s: %s"),
+ path, mu_strerror (status));
if (status == ENOSYS)
mbsize = 0; /* Try to continue anyway */
else
@@ -206,7 +207,7 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
switch (check_quota (auth, mbsize, &n))
{
case MQUOTA_EXCEEDED:
- mailer_err (_("%s: mailbox quota exceeded for this recipient"), name);
+ maidag_error (_("%s: mailbox quota exceeded for this recipient"), name);
if (errp)
asprintf (errp, "%s: mailbox quota exceeded for this recipient",
name);
@@ -220,16 +221,16 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
default:
if ((status = mu_mailbox_get_size (imbx, &msg_size)))
{
- mailer_err (_("Cannot get message size (input message %s): %s"),
- path, mu_strerror (status));
+ maidag_error (_("Cannot get message size (input message %s): %s"),
+ path, mu_strerror (status));
exit_code = EX_UNAVAILABLE;
failed++;
}
else if (msg_size > n)
{
- mailer_err (_("%s: message would exceed maximum mailbox size for "
+ maidag_error (_("%s: message would exceed maximum mailbox size for "
"this recipient"),
- name);
+ name);
if (errp)
asprintf (errp,
"%s: message would exceed maximum mailbox size "
@@ -248,8 +249,8 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
status = mu_mailbox_append_message (mbox, msg);
if (status)
{
- mailer_err (_("Error writing to mailbox %s: %s"),
- path, mu_strerror (status));
+ maidag_error (_("Error writing to mailbox %s: %s"),
+ path, mu_strerror (status));
failed++;
}
else
@@ -257,8 +258,8 @@ deliver_to_user (mu_mailbox_t imbx, mu_mailbox_t mbox, mu_message_t msg,
status = mu_mailbox_sync (mbox);
if (status)
{
- mailer_err (_("Error flushing mailbox %s: %s"),
- path, mu_strerror (status));
+ maidag_error (_("Error flushing mailbox %s: %s"),
+ path, mu_strerror (status));
failed++;
}
}
@@ -283,7 +284,7 @@ deliver (mu_mailbox_t imbx, char *name, char **errp)
auth = mu_get_auth_by_name (name);
if (!auth)
{
- mailer_err (_("%s: no such user"), name);
+ maidag_error (_("%s: no such user"), name);
if (errp)
asprintf (errp, "%s: no such user", name);
exit_code = EX_UNAVAILABLE;
@@ -301,16 +302,16 @@ deliver (mu_mailbox_t imbx, char *name, char **errp)
if ((status = mu_mailbox_get_message (imbx, 1, &msg)) != 0)
{
- mailer_err (_("Cannot get message from the temporary mailbox: %s"),
- mu_strerror (status));
+ maidag_error (_("Cannot get message from the temporary mailbox: %s"),
+ mu_strerror (status));
mu_auth_data_free (auth);
return EX_TEMPFAIL;
}
if ((status = mu_mailbox_create (&mbox, auth->mailbox)) != 0)
{
- mailer_err (_("Cannot open mailbox %s: %s"),
- auth->mailbox, mu_strerror (status));
+ maidag_error (_("Cannot open mailbox %s: %s"),
+ auth->mailbox, mu_strerror (status));
mu_auth_data_free (auth);
return EX_TEMPFAIL;
}
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 91d601750..217508ac0 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -490,7 +490,7 @@ main (int argc, char *argv[])
current_uid = getuid ();
if (log_to_stderr == -1)
- log_to_stderr = (getuid () != 0);
+ log_to_stderr = !lmtp_mode && (current_uid != 0);
if (!log_to_stderr)
{
@@ -502,7 +502,7 @@ main (int argc, char *argv[])
mu_debug_default_printer = mu_debug_syslog_printer;
}
-
+
argc -= arg_index;
argv += arg_index;
diff --git a/maidag/maidag.h b/maidag/maidag.h
index c92211307..7509cb005 100644
--- a/maidag/maidag.h
+++ b/maidag/maidag.h
@@ -136,7 +136,7 @@ int maidag_lmtp_server (void);
int lmtp_connection (int fd, struct sockaddr *sa, int salen, void *data,
mu_ip_server_t srv, time_t timeout, int transcript);
-void mailer_err (const char *fmt, ...) MU_PRINTFLIKE(1, 2);
+void maidag_error (const char *fmt, ...) MU_PRINTFLIKE(1, 2);
void notify_biff (mu_mailbox_t mbox, char *name, size_t size);
void guess_retval (int ec);
diff --git a/maidag/mailtmp.c b/maidag/mailtmp.c
index 4aacfdf61..389043a4d 100644
--- a/maidag/mailtmp.c
+++ b/maidag/mailtmp.c
@@ -44,16 +44,16 @@ mail_tmp_begin (struct mail_tmp **pmtmp, const char *from)
MU_STREAM_RDWR)))
{
free (mtmp);
- mailer_err (_("Unable to open temporary file: %s"),
- mu_strerror (status));
+ maidag_error (_("Unable to open temporary file: %s"),
+ mu_strerror (status));
return status;
}
if ((status = mu_stream_open (mtmp->stream)))
{
free (mtmp);
- mailer_err (_("unable to open temporary file: %s"),
- mu_strerror (status));
+ maidag_error (_("unable to open temporary file: %s"),
+ mu_strerror (status));
return status;
}
mtmp->from = from;
@@ -94,7 +94,7 @@ mail_tmp_add_line (struct mail_tmp *mtmp, char *buf, size_t buflen)
}
else
{
- mailer_err (_("Cannot determine sender address"));
+ maidag_error (_("Cannot determine sender address"));
return EINVAL;
}
if (auth)
@@ -112,7 +112,8 @@ mail_tmp_add_line (struct mail_tmp *mtmp, char *buf, size_t buflen)
if (status)
{
- mailer_err (_("Error writing temporary file: %s"), mu_strerror (status));
+ maidag_error (_("Error writing temporary file: %s"),
+ mu_strerror (status));
mu_stream_destroy (&mtmp->stream, mu_stream_get_owner (mtmp->stream));
}
mtmp->had_nl = buf[buflen-1] == '\n';
@@ -137,7 +138,8 @@ mail_tmp_finish (struct mail_tmp *mtmp, mu_mailbox_t *mbox)
if (status)
{
errno = status;
- mailer_err (_("Error writing temporary file: %s"), mu_strerror (status));
+ maidag_error (_("Error writing temporary file: %s"),
+ mu_strerror (status));
mu_stream_destroy (&mtmp->stream, mu_stream_get_owner (mtmp->stream));
return status;
}
@@ -147,7 +149,8 @@ mail_tmp_finish (struct mail_tmp *mtmp, mu_mailbox_t *mbox)
|| (status = mu_mailbox_open (*mbox, MU_STREAM_READ))
|| (status = mu_mailbox_set_stream (*mbox, mtmp->stream)))
{
- mailer_err (_("Error opening temporary file: %s"), mu_strerror (status));
+ maidag_error (_("Error opening temporary file: %s"),
+ mu_strerror (status));
mu_stream_destroy (&mtmp->stream, mu_stream_get_owner (mtmp->stream));
return status;
}
@@ -156,8 +159,8 @@ mail_tmp_finish (struct mail_tmp *mtmp, mu_mailbox_t *mbox)
if (status)
{
errno = status;
- mailer_err (_("Error creating temporary message: %s"),
- mu_strerror (status));
+ maidag_error (_("Error creating temporary message: %s"),
+ mu_strerror (status));
mu_stream_destroy (&mtmp->stream, mu_stream_get_owner (mtmp->stream));
return status;
}
diff --git a/maidag/util.c b/maidag/util.c
index f0e41de1f..463a10fd7 100644
--- a/maidag/util.c
+++ b/maidag/util.c
@@ -58,19 +58,19 @@ switch_user_id (struct mu_auth_data *auth, int user)
# error "No way to reset user privileges?"
#endif
if (rc < 0)
- mailer_err ("setreuid(0, %d): %s (r=%d, e=%d)",
- uid, strerror (errno), getuid (), geteuid ());
+ maidag_error ("setreuid(0, %d): %s (r=%d, e=%d)",
+ uid, strerror (errno), getuid (), geteuid ());
return rc;
}
void
-mailer_err (const char *fmt, ...)
+maidag_error (const char *fmt, ...)
{
va_list ap;
guess_retval (errno);
va_start (ap, fmt);
- if (!lmtp_mode && !log_to_stderr)
+ if (log_to_stderr)
{
vfprintf (stderr, fmt, ap);
fputc ('\n', stderr);

Return to:

Send suggestions and report system problems to the System administrator.