summaryrefslogtreecommitdiffabout
path: root/src/main.c
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-19 13:38:36 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2007-11-19 13:38:36 (GMT)
commitb1a3e134c1e3127cf3f31cdfa24d784858c9873d (patch) (side-by-side diff)
tree1058a6d8b4a5e9a328ed5356ec94c69f0be72732 /src/main.c
parent4b9defbcfe01fb05acf9ecd74a683390d6110872 (diff)
downloadmailfromd-b1a3e134c1e3127cf3f31cdfa24d784858c9873d.tar.gz
mailfromd-b1a3e134c1e3127cf3f31cdfa24d784858c9873d.tar.bz2
* src/mu_dbm.c [WITH_GDBM]: do not bail out if the database does
not exist. * src/mailfromd.h: Add argp.h * src/bi_sa.m4: Minor fixes. * src/main.c: Support for Mailutils CVS HEAD. * configure.ac: Likewise. git-svn-id: file:///svnroot/mailfromd/trunk@1527 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'src/main.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/main.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 938a82b..1fd5194 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,8 +35,11 @@
#include <netdb.h>
#include <mailutils/mailutils.h>
-#include <mailutils/argp.h>
-
+#if MAILUTILS_VERSION_NUMBER < 1290
+# include <mailutils/argp.h>
+#else
+# include <mailutils/libargp.h>
+#endif
#include "mailfromd.h"
#include "syslog_async.h"
@@ -404,7 +407,7 @@ set_mailfrom(void *value)
rc = mu_address_create(&addr, value);
if (rc) {
mu_error(_("Cannot create address `%s': %s"),
- value, mu_strerror(rc));
+ (char*)value, mu_strerror(rc));
return;
}
mu_address_destroy(&addr);
@@ -1443,13 +1446,13 @@ switch_to_privs(uid_t uid, gid_t gid)
#if defined(HAVE_SETREUID)
if (geteuid() != uid) {
if (setreuid(uid, -1) < 0) {
- mu_error(_("setreuid(%lu,-1) failed"),
+ mu_error(_("setreuid(%lu,-1) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
}
if (setuid(uid) < 0) {
- mu_error(_("second setuid(%lu) failed"),
+ mu_error(_("second setuid(%lu) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
@@ -1457,7 +1460,7 @@ switch_to_privs(uid_t uid, gid_t gid)
} else
#endif
{
- mu_error(_("setuid(%lu) failed"),
+ mu_error(_("setuid(%lu) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
@@ -1756,6 +1759,7 @@ version(FILE *stream, struct argp_state *state)
int
main(int argc, char **argv)
{
+ int rc;
int index;
#ifdef ENABLE_NLS
@@ -1782,8 +1786,15 @@ main(int argc, char **argv)
db_format_setup();
include_path_setup();
save_cmdline(argc, argv);
+
mu_argp_init(program_version, "<" PACKAGE_BUGREPORT ">");
- mu_argp_parse(&argp, &argc, &argv, 0, capa, &index, NULL);
+#if MAILUTILS_VERSION_NUMBER < 1290
+ rc = mu_argp_parse(&argp, &argc, &argv, 0, capa, &index, NULL);
+#else
+ rc = mu_app_init(&argp, capa, NULL, argc, argv, 0, &index, NULL);
+#endif
+ if (rc)
+ exit (EX_CONFIG);
log_setup(log_to_stderr);

Return to:

Send suggestions and report system problems to the System administrator.