From c4d598939ac275ce0c4a28d6b76efd1e2e47af05 Mon Sep 17 00:00:00 2001
From: Richard Levitte <levitte@openssl.org>
Date: Mon, 23 May 2016 00:36:37 +0200
Subject: [PATCH] Improve the checking of pod sections

(i.e. remove some bugs)

Reviewed-by: Rich Salz <rsalz@openssl.org>
---
 util/process_docs.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/util/process_docs.pl b/util/process_docs.pl
index 150e48bf08..c07cb755cc 100644
--- a/util/process_docs.pl
+++ b/util/process_docs.pl
@@ -87,8 +87,10 @@ foreach my $subdir (keys %{$options{subdir}}) {
                 print STDERR "Found section number $1\n" if $options{debug};
                 $podinfo{section} = $1;
             }
-            last if m|^=head1| && defined $podinfo{lastsect} eq "NAME";
-            if (m|^head1=\s*(.*)|) {
+            last if (m|^=head1|
+                     && defined $podinfo{lastsect}
+                     && $podinfo{lastsect} eq "NAME");
+            if (m|^=head1\s*(.*)|) {
                 $podinfo{lastsect} = $1;
                 $podinfo{lastsect} =~ s/\s+$//;
                 $podinfo{lastsecttext} = "";
-- 
2.25.1