On Fri, Apr 05, 2002 at 09:01:21AM -0800, Andrew Ryan wrote:
> This patch is interesting since it doesn't really seem to change the logic 
> of the code, just the syntax (splitting out into another conditional). I'm 
> probably just missing something, can you explain the patch?

The patch does change the logic.

The original logic was:

        elsif ($var eq "exclude_period" && inPeriod (time, $args) == -1)
        {
                close (CFG);
        }
        else
        {
                close (CFG);
        }


Please note that CFG is getting closed in else part when we are
processing exclude_period and time period is valid.

I changed this logic to 

        elsif ($var eq "exclude_period")
        {
                if (inPeriod (time, $args) == -1)
                {
                        close(CFG);
                }
        }
        else
        {
                close(CFG);
        }

so that CFG is not closed when time period is valid and exclude_period is
being processed further.
        

> 
> Also, please diff -u or diff -c so readers of your patches can stay sane 
> while reading them :)
> 

Sorry about that, will use that in the future.

Best, -Kastus


-- 
Konstantin 'Kastus' Shchuka
Unix System Administrator
ePocrates Inc.
tel 650.232.4886
fax 650.592.6995

PS Just in case, a unified diff:

--- /usr/local/lib/mon/mon-ORIG Fri Dec 14 12:55:44 2001
+++ /usr/local/lib/mon/mon      Fri Dec 14 14:49:20 2001
@@ -1458,10 +1458,13 @@
                    $args = $ex;
                }
 
-               elsif ($var eq "exclude_period" && inPeriod (time, $args) == -1)
+               elsif ($var eq "exclude_period" )
                {
-                   close (CFG);
-                   return "cf error: malformed exclude_period '$args' (the specified 
time period is not valid as per Time::Period::inPeriod), line $line_num";
+                       if (inPeriod (time, $args) == -1)
+                       {
+                               close (CFG);
+                               return "cf error: malformed exclude_period '$args' 
+(the specified time period is not valid as per Time::Period::inPeriod), line 
+$line_num";
+                       }
                }
 
                else

Reply via email to