summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2015-12-22 21:50:23 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2015-12-22 21:50:23 +0000
commitffe9a25a62e4d0ce1713d6f07fab569a9293bcdb (patch)
tree71048dda97cf9e8119bafcdc18fe93eabea5ae3f /usr.sbin
parentbeb2dd9d3c97493ef5d3ea2db1db82f1ba447b6b (diff)
fix sendmail options parsing
diff from Serguey Parkhomovsky <sergueyparkhomovsky@gmail.com>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/smtpctl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 7c2ba3c37d9..7fff385ff60 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.142 2015/12/22 15:59:10 sunil Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.143 2015/12/22 21:50:22 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -990,6 +990,7 @@ main(int argc, char **argv)
* determine whether we are called with flags
* that should invoke makemap/newaliases.
*/
+ opterr = 0;
while ((ch = getopt(argc, argv, "b:C:O:")) != -1) {
switch (ch) {
case 'b':
@@ -1006,10 +1007,13 @@ main(int argc, char **argv)
break;
}
}
- argc -= optind;
- argv += optind;
- optind = 0;
+ opterr = 1;
+
if (sendmail_makemap) {
+ argc -= optind;
+ argv += optind;
+ optind = 0;
+
memset(&args, 0, sizeof args);
addargs(&args, "%s", "makemap");
for (i = 0; i < argc; i++)
@@ -1021,6 +1025,7 @@ main(int argc, char **argv)
return makemap(args.num, args.list);
}
+ optind = 0;
if (!srv_connect())
offlinefp = offline_file();