From: "Haelwenn (lanodan) Monnier" <[email protected]>
---
doc/mdevd.html | 3 ++-
src/mdevd/mdevd.c | 9 ++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/doc/mdevd.html b/doc/mdevd.html
index 7c2a869..883be7b 100644
--- a/doc/mdevd.html
+++ b/doc/mdevd.html
@@ -49,7 +49,7 @@ <h1> The <tt>mdevd</tt> program </h1>
<h2> Interface </h2>
<pre>
- mdevd [ -v <em>verbosity</em> ] [ -D <em>notif</em> ] [ -I
<em>intake</em> ] [ -o <em>outputfd</em> ] [ -I <em>intake</em> ] [ -O
<em>nlgroups</em> ] [ -b <em>kbufsz</em> ] [ -f <em>conffile</em> ] [ -n ] [ -s
<em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ] [ -C ]
+ mdevd [ -v <em>verbosity</em> ] [ -D <em>notif</em> ] [ -I
<em>intake</em> ] [ -o <em>outputfd</em> ] [ -I <em>intake</em> ] [ -O
<em>nlgroups</em> ] [ -b <em>kbufsz</em> ] [ -f <em>conffile</em> ] [ -n ] [ -s
<em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ] [ -C ] [ -t
]
</pre>
<ul>
@@ -149,6 +149,7 @@ <h2> Options </h2>
at boot time, when mdevd is ready. The <tt>examples/s6-rc</tt> subdirectory of
the mdevd package shows a way to do this with the
<a href="//skarnet.org/software/s6-rc/">s6-rc</a> service manager. </li>
+ <li> <tt>-t</tt> : Do not run, just test the configuration file.</li>
</ul>
<h2> Configuration file </h2>
diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c
index f5222f7..5c532db 100644
--- a/src/mdevd/mdevd.c
+++ b/src/mdevd/mdevd.c
@@ -910,12 +910,13 @@ int main (int argc, char const *const *argv)
unsigned int intake = 1 ;
unsigned int outputfd = 0 ;
unsigned int rebc = 0 ;
+ unsigned int configtest = 0;
PROG = "mdevd" ;
{
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "nv:D:I:o:O:b:f:s:d:F:C", &l) ;
+ int opt = subgetopt_r(argc, argv, "nv:D:I:o:O:b:f:s:d:F:Ct", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -931,6 +932,7 @@ int main (int argc, char const *const *argv)
case 'd' : slashdev = l.arg ; break ;
case 'F' : fwbase = l.arg ; break ;
case 'C' : docoldplug = 1 ; break ;
+ case 't' : configtest = 1 ; break ;
default : dieusage() ;
}
}
@@ -1024,6 +1026,11 @@ int main (int argc, char const *const *argv)
script[scriptlen++] = scriptelem_catchall ;
script_secondpass(storage, script, envmatch) ;
cont = 2 ;
+ if (configtest)
+ {
+ script_free(script, scriptlen, envmatch, envmatchlen) ;
+ return 0;
+ }
if (docoldplug)
{
char const *cargv[2] = { MDEVD_BINPREFIX "mdevd-coldplug", 0 } ;
base-commit: f2dfc6263ece1fc0f41e01adbb33350b7f024d89
--
2.49.0