]> git.ipfire.org Git - people/ms/dma.git/commitdiff
don't treat -options following -q as argument to it
authorSimon Schubert <2@0x2c.org>
Fri, 17 Feb 2012 20:52:30 +0000 (21:52 +0100)
committerSimon Schubert <2@0x2c.org>
Fri, 17 Feb 2012 20:52:30 +0000 (21:52 +0100)
sendmail's -q takes an optional argument, but the way we use getopt(3)
does not support this.  Work around this by backtracking if the
argument to -q starts with a dash, indicating that it is an option instead.

dma.c

diff --git a/dma.c b/dma.c
index 48c429c443543e2c822bd82c7da8322d2bac453a..02fb84618009a58b096d1b6a3e84454383d5c48f 100644 (file)
--- a/dma.c
+++ b/dma.c
@@ -476,6 +476,9 @@ main(int argc, char **argv)
                        break;
 
                case 'q':
+                       /* Don't let getopt slup up other arguments */
+                       if (optarg && *optarg == '-')
+                               optind--;
                        doqueue = 1;
                        break;