Commit 321044b0 321044b00bdb4347fff4966ede7d575c5acff483 by Alain Magloire

use mu_error() everywhere.

1 parent cfb7e728
2001-04-23 Alain Magloire
Sergey Poznyakoff noted: When the user's mailbox ha zeor size mmap
fails on Solaris. On GNU/Linux it reuturn NULL buf subsequet munmap
fails.
* mailbox/mapfile_stream.c: To take care of this will set
the mfs->ptr to NULL for len == 0;
2001-04-23 Sergey Poznyakoff
Several sources from mailbox subdirectory call fprintf(stderr,...)
to issue error messages. As the stderr usually gets connected to
the output socket, the client program receives all these error
messages and gets confused, since they do not start with
rfc-compliant +OK, -ERR keywords. So I have added a module
error.c and changed all these fprintf's to error()'s. Actual
function that ouputs the messages can be supplied by the
application using error_set_print() call.
2001-04-23 Alain Magloire
* pop3d/*.[ch]: Rename all the pop function pop3d_xx()
instead of pop3_xx() to be consistent with imap4d/*.
......
......@@ -6,6 +6,7 @@ pkginclude_HEADERS = \
body.h \
debug.h \
envelope.h \
error.h \
filter.h \
folder.h \
header.h \
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILUTILS_ERROR_H
#define _MAILUTILS_ERROR_H
#include <stdarg.h>
#ifndef __P
#ifdef __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*__P */
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*error_pfn_t) __P ((const char *fmt, va_list ap));
extern int mu_error __P ((const char *fmt, ...));
extern void mu_error_set_print __P ((error_pfn_t));
#ifdef __cplusplus
}
#endif
#endif /* _MAILUTILS_ERROR_H */
......@@ -45,6 +45,7 @@ memory_stream.c \
mime.c \
misc.c \
monitor.c \
muerror.c \
observer.c \
parse822.c \
property.c \
......
......@@ -30,6 +30,7 @@
#include <unistd.h>
#include <mailutils/stream.h>
#include <mailutils/error.h>
struct _file_stream
{
......@@ -266,7 +267,7 @@ _file_open (stream_t stream, const char *filename, int port, int flags)
|| filebuf.st_nlink != 1
|| (fdbuf.st_mode & S_IFMT) != S_IFREG)
{
fprintf(stderr,"%s must be a plain file with one link\n", filename);
mu_error ("%s must be a plain file with one link\n", filename);
close (fd);
return EINVAL;
}
......
......@@ -36,6 +36,7 @@
#endif
#include <imap0.h>
#include <mailutils/error.h>
/* Variable use for the registrar. */
static struct _record _imap_record =
......@@ -1505,7 +1506,7 @@ imap_fetch (f_imap_t f_imap)
{
status = imap_rfc822_header (f_imap, &sp);
}
/* else fprintf (stderr, "not supported RFC822 option\n"); */
/* else mu_error ("not supported RFC822 option\n"); */
}
else
{
......@@ -1516,7 +1517,7 @@ imap_fetch (f_imap_t f_imap)
{
status = imap_uid (f_imap, &sp);
}
/* else fprintf (stderr, "not supported FETCH command\n"); */
/* else mu_error ("not supported FETCH command\n"); */
}
return status;
}
......@@ -1734,7 +1735,7 @@ imap_parse (f_imap_t f_imap)
}
#if 0
/* Comment out to see all reading traffic. */
fprintf (stderr, "\t\t%s", f_imap->buffer);
mu_error ("\t\t%s", f_imap->buffer);
#endif
/* We do not want to step over f_imap->buffer since it can be use
......@@ -1775,7 +1776,7 @@ imap_parse (f_imap_t f_imap)
/* The human-readable text contains a special alert that
MUST be presented to the user in a fashion that calls
the user's attention to the message. */
fprintf (stderr, "ALERT: %s\n", (sp) ? sp : "");
mu_error ("ALERT: %s\n", (sp) ? sp : "");
}
else if (strcasecmp (subtag, "BADCHARSET") == 0)
{
......@@ -1882,18 +1883,18 @@ imap_parse (f_imap_t f_imap)
{
/* Not sure why we would get an untagged ok...but we do... */
/* Still should we be verbose about is ? */
fprintf (stderr, "Untagged OK: %s\n", remainder);
mu_error ("Untagged OK: %s\n", remainder);
}
}
else if (strcasecmp (response, "NO") == 0)
{
/* This does not mean failure but rather a strong warning. */
fprintf (stderr, "Untagged NO: %s\n", remainder);
mu_error ("Untagged NO: %s\n", remainder);
}
else if (strcasecmp (response, "BAD") == 0)
{
/* We're dead, protocol/syntax error. */
fprintf (stderr, "Untagged BAD: %s\n", remainder);
mu_error ("Untagged BAD: %s\n", remainder);
}
else if (strcasecmp (response, "PREAUTH") == 0)
{
......@@ -1953,8 +1954,8 @@ imap_parse (f_imap_t f_imap)
else
{
/* Once again, check for something strange. */
fprintf (stderr, "unknown untagged response: \"%s\" %s\n",
response, remainder);
mu_error ("unknown untagged response: \"%s\" %s\n",
response, remainder);
}
}
/* Continuation token ???. */
......@@ -1977,7 +1978,7 @@ imap_parse (f_imap_t f_imap)
folder_get_observable (f_imap->folder, &observable);
observable_notify (observable, MU_EVT_AUTHORITY_FAILED);
}
fprintf (stderr, "NO/Bad Tagged: %s %s\n", response, remainder);
mu_error ("NO/Bad Tagged: %s %s\n", response, remainder);
status = EINVAL;
}
}
......
......@@ -53,7 +53,8 @@ _mapfile_destroy (stream_t stream)
if (mfs->ptr != MAP_FAILED)
{
munmap (mfs->ptr, mfs->size);
if (mfs->ptr)
munmap (mfs->ptr, mfs->size);
close (mfs->fd);
}
free (mfs);
......@@ -122,7 +123,7 @@ _mapfile_write (stream_t stream, const char *iptr, size_t isize,
/* Bigger we have to remmap. */
if (mfs->size < (offset + isize))
{
if (munmap (mfs->ptr, mfs->size) != 0)
if (mfs->ptr && munmap (mfs->ptr, mfs->size) != 0)
{
int err = errno;
mfs->ptr = MAP_FAILED;
......@@ -154,7 +155,7 @@ _mapfile_truncate (stream_t stream, off_t len)
if (mfs->ptr == MAP_FAILED)
return EINVAL;
/* Remap. */
if (munmap (mfs->ptr, mfs->size) != 0)
if (mfs->ptr && munmap (mfs->ptr, mfs->size) != 0)
{
int err = errno;
mfs->ptr = MAP_FAILED;
......@@ -163,13 +164,13 @@ _mapfile_truncate (stream_t stream, off_t len)
}
if (ftruncate (mfs->fd, len) != 0)
return errno;
mfs->ptr = mmap (0, len, mfs->flags, MAP_SHARED, mfs->fd, 0);
if (mfs->ptr == MAP_FAILED)
{
int err = errno;
close (mfs->fd);
return err;
}
mfs->ptr = (len) ? mmap (0, len, mfs->flags, MAP_SHARED, mfs->fd, 0) : NULL;
if (mfs->ptr == MAP_FAILED)
{
int err = errno;
close (mfs->fd);
return err;
}
mfs->size = len;
return 0;
}
......@@ -183,17 +184,26 @@ _mapfile_size (stream_t stream, off_t *psize)
if (mfs->ptr == MAP_FAILED)
return EINVAL;
msync (mfs->ptr, mfs->size, MS_SYNC);
if (mfs->ptr)
msync (mfs->ptr, mfs->size, MS_SYNC);
if (fstat(mfs->fd, &stbuf) != 0)
return errno;
if (mfs->size != (size_t)stbuf.st_size)
{
if (munmap (mfs->ptr, mfs->size) == 0)
if (mfs->ptr)
err = munmap (mfs->ptr, mfs->size);
if (err == 0)
{
mfs->size = stbuf.st_size;
mfs->ptr = mmap (0, mfs->size, mfs->flags , MAP_SHARED, mfs->fd, 0);
if (mfs->ptr == MAP_FAILED)
err = errno;
if (mfs->size)
{
mfs->ptr = mmap (0, mfs->size, mfs->flags , MAP_SHARED,
mfs->fd, 0);
if (mfs->ptr == MAP_FAILED)
err = errno;
}
else
mfs->ptr = NULL;
}
else
err = errno;
......@@ -216,7 +226,9 @@ static int
_mapfile_flush (stream_t stream)
{
struct _mapfile_stream *mfs = stream_get_owner (stream);
return msync (mfs->ptr, mfs->size, MS_SYNC);
if (mfs->ptr != MAP_FAILED && mfs->ptr != NULL)
return msync (mfs->ptr, mfs->size, MS_SYNC);
return 0;
}
static int
......@@ -235,7 +247,7 @@ _mapfile_close (stream_t stream)
int err = 0;
if (mfs->ptr != MAP_FAILED)
{
if (munmap (mfs->ptr, mfs->size) != 0)
if (mfs->ptr && munmap (mfs->ptr, mfs->size) != 0)
err = errno;
if (close (mfs->fd) != 0)
err = errno;
......@@ -257,7 +269,8 @@ _mapfile_open (stream_t stream, const char *filename, int port, int flags)
/* Close any previous file. */
if (mfs->ptr != MAP_FAILED)
{
munmap (mfs->ptr, mfs->size);
if (mfs->ptr)
munmap (mfs->ptr, mfs->size);
mfs->ptr = MAP_FAILED;
}
if (mfs->fd != -1)
......@@ -277,7 +290,7 @@ _mapfile_open (stream_t stream, const char *filename, int port, int flags)
flg = O_RDWR;
}
else if (flags & MU_STREAM_CREAT)
return ENOTSUP;
return ENOSYS;
else /* default */
{
mflag = PROT_READ;
......@@ -294,14 +307,19 @@ _mapfile_open (stream_t stream, const char *filename, int port, int flags)
return err;
}
mfs->size = st.st_size;
mfs->ptr = mmap (0, mfs->size, mflag , MAP_SHARED, mfs->fd, 0);
if (mfs->ptr == MAP_FAILED)
if (mfs->size)
{
int err = errno;
close (mfs->fd);
mfs->ptr = MAP_FAILED;
return err;
mfs->ptr = mmap (0, mfs->size, mflag , MAP_SHARED, mfs->fd, 0);
if (mfs->ptr == MAP_FAILED)
{
int err = errno;
close (mfs->fd);
mfs->ptr = MAP_FAILED;
return err;
}
}
else
mfs->ptr = NULL;
mfs->flags = mflag;
stream_set_flags (stream, flags |MU_STREAM_NO_CHECK);
return 0;
......@@ -313,7 +331,7 @@ int
mapfile_stream_create (stream_t *stream)
{
#ifndef _POSIX_MAPPED_FILES
return ENOTSUP;
return ENOSYS;
#else
struct _mapfile_stream *fs;
int ret;
......
......@@ -29,6 +29,7 @@
#endif
#include <mailutils/mailbox.h>
#include <mailutils/error.h>
#ifndef _PATH_MAILDIR
# define _PATH_MAILDIR "/usr/spool/mail"
......@@ -69,7 +70,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail)
user = (getenv ("LOGNAME")) ? getenv ("LOGNAME") : getenv ("USER");
if (user == NULL)
{
fprintf (stderr, "Who am I ?\n");
mu_error ("Who am I ?\n");
return EINVAL;
}
}
......
......@@ -29,6 +29,7 @@
#include <time.h>
#include <mailutils/address.h>
#include <mailutils/error.h>
#include <mailbox0.h>
#include <registrar0.h>
#include <imap0.h>
......@@ -636,7 +637,7 @@ imap_expunge (mailbox_t mailbox)
f_imap->state = IMAP_NO_STATE;
default:
/* fprintf (stderr, "imap_expunge: unknow state\n"); */
/* mu_error ("imap_expunge: unknow state\n"); */
break;
} /* switch (state) */
} /* message_get_attribute() */
......@@ -742,7 +743,7 @@ static int
imap_append_message (mailbox_t mailbox, message_t msg)
{
size_t total;
int status;
int status = 0;
m_imap_t m_imap = mailbox->data;
f_imap_t f_imap = m_imap->f_imap;
......@@ -859,7 +860,7 @@ imap_append_message (mailbox_t mailbox, message_t msg)
MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
default:
/* fprintf (stderr, "imap_expunge: unknow state\n"); */
/* mu_error ("imap_expunge: unknow state\n"); */
break;
}
f_imap->state = IMAP_NO_STATE;
......
......@@ -53,6 +53,7 @@
#include <mailutils/body.h>
#include <mailutils/header.h>
#include <mailutils/attribute.h>
#include <mailutils/error.h>
#include <registrar0.h>
#include <mailbox0.h>
......@@ -480,9 +481,9 @@ mbox_is_updated (mailbox_t mailbox)
{
observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT);
/* And be verbose. ? */
fprintf (stderr, "* BAD : Mailbox corrupted, shrank size\n");
mu_error ("* BAD : Mailbox corrupted, shrank size\n");
/* FIXME: should I crash. */
return 1;
return 0;
}
return (mud->size == size);
}
......@@ -590,7 +591,7 @@ mbox_expunge (mailbox_t mailbox)
{
if (tmpmboxname)
free (tmpmboxname);
fprintf (stderr, "Failed to create temporary file when expunging.\n");
mu_error ("Failed to create temporary file when expunging.\n");
return errno;
}
......@@ -650,7 +651,7 @@ mbox_expunge (mailbox_t mailbox)
mailbox_destroy (&tmpmailbox);
remove (tmpmboxname);
free (tmpmboxname);
fprintf (stderr, "Failed to grab the lock\n");
mu_error ("Failed to grab the lock\n");
return ENOLCK;
}
......@@ -702,8 +703,8 @@ mbox_expunge (mailbox_t mailbox)
status = mbox_get_message (mailbox, i, &msg);
if (status != 0)
{
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
}
......@@ -711,8 +712,8 @@ mbox_expunge (mailbox_t mailbox)
&total, 1, (i == save_imapbase));
if (status != 0)
{
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
/* Clear the dirty bit. */
......@@ -734,8 +735,8 @@ mbox_expunge (mailbox_t mailbox)
|| (status = stream_write (tmpmailbox->stream, buffer, n,
total, &n) != 0))
{
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
len -= n;
......@@ -746,8 +747,8 @@ mbox_expunge (mailbox_t mailbox)
status = stream_write (tmpmailbox->stream, "\n", 1, total, &n);
if (status != 0)
{
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
total++;
......@@ -776,8 +777,8 @@ mbox_expunge (mailbox_t mailbox)
total, &n);
if (status != 0)
{
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
total += n;
......@@ -787,8 +788,8 @@ mbox_expunge (mailbox_t mailbox)
else if (len < 0)
{
/* Corrupted mailbox. */
fprintf (stderr, "Error expunge:%d: %s", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s", __LINE__,
strerror (status));
goto bailout0;
}
}
......@@ -808,8 +809,8 @@ mbox_expunge (mailbox_t mailbox)
status = stream_write (mailbox->stream, buffer, n, offset, &n);
if (status != 0)
{
fprintf (stderr, "Error expunge:%d: %s\n", __LINE__,
strerror (status));
mu_error ("Error expunge:%d: %s\n", __LINE__,
strerror (status));
goto bailout;
}
off += n;
......@@ -822,8 +823,8 @@ mbox_expunge (mailbox_t mailbox)
status = stream_truncate (mailbox->stream, total + marker);
if (status != 0)
{
fprintf (stderr, "Error expunging:%d: %s\n", __LINE__,
strerror (status));
mu_error ("Error expunging:%d: %s\n", __LINE__,
strerror (status));
goto bailout;
}
......
......@@ -45,6 +45,7 @@
#include <mailutils/attribute.h>
#include <mailutils/url.h>
#include <mailutils/auth.h>
#include <mailutils/error.h>
#include <mailbox0.h>
#include <registrar0.h>
......@@ -592,7 +593,7 @@ pop_open (mailbox_t mbox, int flags)
default:
/*
fprintf (stderr, "pop_open unknown state\n");
mu_error ("pop_open unknown state\n");
*/
break;
}/* End AUTHORISATION state. */
......@@ -648,13 +649,13 @@ pop_close (mailbox_t mbox)
lets just be verbose about the error but close the connection
anyway. */
if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
fprintf (stderr, "pop_close: %s\n", mpd->buffer);
mu_error ("pop_close: %s\n", mpd->buffer);
stream_close (mbox->stream);
break;
default:
/*
fprintf (stderr, "pop_close unknow state");
mu_error ("pop_close unknow state");
*/
break;
} /* UPDATE state. */
......@@ -895,7 +896,7 @@ pop_messages_count (mailbox_t mbox, size_t *pcount)
default:
/*
fprintf (stderr, "pop_messages_count: unknow state\n");
mu_error ("pop_messages_count: unknow state\n");
*/
break;
}
......@@ -1010,7 +1011,7 @@ pop_expunge (mailbox_t mbox)
break;
default:
/* fprintf (stderr, "pop_expunge: unknow state\n"); */
/* mu_error ("pop_expunge: unknow state\n"); */
break;
} /* switch (state) */
} /* if attribute_is_deleted() */
......@@ -1100,7 +1101,7 @@ pop_message_size (message_t msg, size_t *psize)
default:
/*
fprintf (stderr, "pop_message_size state\n");
mu_error ("pop_message_size state\n");
*/
break;
}
......@@ -1291,7 +1292,7 @@ pop_uidl (message_t msg, char *buffer, size_t buflen, size_t *pnwriten)
default:
/*
fprintf (stderr, "pop_uidl state\n");
mu_error ("pop_uidl state\n");
*/
break;
}
......@@ -1385,7 +1386,7 @@ pop_top (header_t header, char *buffer, size_t buflen,
MAILBOX_DEBUG0 (mpd->mbox, MU_DEBUG_PROT, mpd->buffer);
if (strncasecmp (mpd->buffer, "+OK", 3) != 0)
{
/* fprintf (stderr, "TOP not implemented\n"); */
/* mu_error ("TOP not implemented\n"); */
/* Fall back to RETR call. */
mpd->state = POP_NO_STATE;
mpm->skip_header = 0;
......@@ -1744,7 +1745,7 @@ pop_retr (pop_message_t mpm, char *buffer, size_t buflen, off_t offset,
/* A convenient break, this is here we can return 0, we're done. */
default:
/* fprintf (stderr, "pop_retr unknow state\n"); */
/* mu_error ("pop_retr unknow state\n"); */
break;
} /* Switch state. */
......
......@@ -258,7 +258,7 @@ message_set_header (message_t msg, header_t hdr, void *owner)
return EINVAL;
if (msg->owner != owner)
return EACCES;
/* Make sure we destoy the old if it was own by the mesg */
/* Make sure we destroy the old if it was own by the mesg */
/* FIXME: I do not know if somebody has already a ref on this ? */
if (msg->header)
header_destroy (&(msg->header), msg);
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <mailutils/error.h>
static int
default_error_printer (const char *fmt, va_list ap)
{
int status;
status = vfprintf (stderr, fmt, ap);
if (status >= 0)
{
if (fputc ('\n', stderr) != EOF)
status++;
}
return status;
}
static error_pfn_t mu_error_printer = default_error_printer;
int
mu_error (const char *fmt, ...)
{
int status;
va_list ap;
if (!mu_error_printer)
return 0;
va_start (ap, fmt);
status = (*mu_error_printer) (fmt, ap);
va_end (ap);
return status;
}
void
mu_error_set_print (error_pfn_t pfn)
{
mu_error_printer = pfn;
}
......@@ -167,8 +167,8 @@ stream_read (stream_t is, char *buf, size_t count,
int r;
/* Fill the buffer, do not want to start empty hand. */
// if (is->rbuffer.count <= 0 || offset < is->rbuffer.offset
// || offset > (is->rbuffer.offset + is->rbuffer.count))
/* if (is->rbuffer.count <= 0 || offset < is->rbuffer.offset */
/* || offset > (is->rbuffer.offset + is->rbuffer.count)) */
if (is->rbuffer.count <= 0 || offset != is->rbuffer.offset)
{
status = refill (is, offset);
......@@ -286,8 +286,8 @@ stream_readline (stream_t is, char *buf, size_t count,
count--; /* Leave space for the null. */
/* If out of range refill. */
// if ((offset < is->rbuffer.offset
// || offset > (is->rbuffer.offset + is->rbuffer.count)))
/* if ((offset < is->rbuffer.offset */
/* || offset > (is->rbuffer.offset + is->rbuffer.count))) */
if (offset != is->rbuffer.offset)
{
status = refill (is, offset);
......@@ -335,7 +335,6 @@ stream_readline (stream_t is, char *buf, size_t count,
(void)memcpy ((void *)s, (void *)p, len);
total += len;
s[len] = 0;
//fprintf (stderr, ":%d %d:%s", len, total, s);
if (pnread)
*pnread = total;
return 0;
......@@ -344,13 +343,11 @@ stream_readline (stream_t is, char *buf, size_t count,
is->rbuffer.ptr += len;
is->rbuffer.offset += len;
(void)memcpy((void *)s, (void *)p, len);
//fprintf (stderr, "!:%d %d\n", len, total);
total += len;
s += len;
count -= len;
}
*s = 0;
//fprintf (stderr, "1:%s", s);
if (pnread)
*pnread = s - buf;
}
......@@ -627,10 +624,7 @@ refill (stream_t stream, off_t offset)
status = stream->_read (stream, stream->rbuffer.ptr,
stream->rbuffer.bufsiz, offset,
(size_t *)&(stream->rbuffer.count));
//fprintf (stderr, "COUNT%d\n", stream->rbuffer.count);
//stream->rbuffer.ptr[stream->rbuffer.count] = 0;
//fprintf (stderr, "%s\n", stream->rbuffer.ptr);
return status;
}
return ENOTSUP;
return ENOSYS;
}
......
......@@ -49,6 +49,8 @@ static struct option long_options[] =
const char *short_options ="d::hip:t:v";
static int syslog_error_printer __P ((const char *fmt, va_list ap));
int
main (int argc, char **argv)
{
......@@ -143,7 +145,8 @@ main (int argc, char **argv)
chdir ("/");
/* Set up for syslog. */
openlog ("gnu-pop3d", LOG_PID, LOG_MAIL);
openlog ("gnu-pop3d", LOG_PID, LOG_FACILITY);
mu_error_set_print(syslog_error_printer);
umask (S_IROTH | S_IWOTH | S_IXOTH); /* 007 */
......@@ -422,3 +425,10 @@ pop3d_daemon (unsigned int maxchildren)
close (connfd);
}
}
static int
syslog_error_printer (const char *fmt, va_list ap)
{
vsyslog (LOG_CRIT, fmt, ap);
return 0;
}
......
......@@ -104,6 +104,7 @@
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/registrar.h>
#include <mailutils/error.h>
/* For Berkley DB2 APOP password file */
#ifdef HAVE_DB_H
......