From 4ab0e97e5ff2dab7dcc5ae14050e442892b8f0ff Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Fri, 10 Jun 2016 08:58:12 +0100 Subject: [PATCH] Fix errors in onak-mail.pl The change to the new configuration file format introduced some paper bag errors in the mail processing script. Fix these, and add a Perl syntax check into the test target to try and prevent this sort of thing in future. --- Makefile.in | 1 + onak-mail.pl.in | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 28e93c9..d0acbfd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -56,6 +56,7 @@ all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.ini \ wotsap $(BACKENDS) test: onak $(BACKENDS) + perl -cw onak-mail.pl @./runtests install: $(PROGS) onak.ini $(BACKENDS) diff --git a/onak-mail.pl.in b/onak-mail.pl.in index 68439d2..8231a12 100644 --- a/onak-mail.pl.in +++ b/onak-mail.pl.in @@ -65,17 +65,17 @@ sub readconfig { open(CONFIG, "@CONFIG@") or die "Can't read config file: $!"; - $section = ""; + my $section = ""; while () { if (/^#/ or /^$/) { # Ignore; comment line. } elsif (/^\[(\w+)\]/) { - section = $1; - } elsif ($section == "main") { + $section = $1; + } elsif ($section eq "main") { if (/^logfile\s*=\s*(.*)/) { $config{'logfile'} = $1; } - } elsif ($section == "mail") { + } elsif ($section eq "mail") { if (/^this_site\s*=\s*(.*)/) { $config{'thissite'} = $1; } elsif (/^maintainer_email\s*=\s*(.*)/) { -- 2.39.5