From 012f3ce8ca03c7a9ae71e4a1747a34c49eb52fe0 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Sun, 18 Mar 2012 14:11:09 +0400 Subject: [PATCH] implement new version of lpt_lock call to properly handle early calls of this function --- yasnd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/yasnd.c b/yasnd.c index 6663f28..cca3289 100644 --- a/yasnd.c +++ b/yasnd.c @@ -74,9 +74,9 @@ void lpt_init() This is needed to lock LPT control circuit, when management computer is rebooted */ -void lpt_lock() +void lpt_lock_cond(bool ignore_options) { - if (lpt_enable) + if (lpt_enable || ignore_options) { if (ioperm (lpt_port, 3, 1)) { @@ -90,6 +90,12 @@ void lpt_lock() } } +// Previous function, but without ignoring lpt_enable option +void lpt_lock() +{ + return lpt_lock_cond(false); +} + // Function, that checks that defined host entry is valid int cb_validate_host(cfg_t *cfg, cfg_opt_t *opt) { @@ -384,7 +390,7 @@ void arg_parse(int argc, char *argv[]) switch(c) { case 'i': - lpt_lock(); + lpt_lock_cond(true); exit(EXIT_SUCCESS); break; default: