From e9c8746a343d050c82be43bdff16cce433ef2ba2 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 4 Aug 2026 11:02:37 -0700 Subject: [PATCH] Use standard split_quoted_string function --- logrotate/logrotate-lib.pl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/logrotate/logrotate-lib.pl b/logrotate/logrotate-lib.pl index 38a09fa23..907f95975 100755 --- a/logrotate/logrotate-lib.pl +++ b/logrotate/logrotate-lib.pl @@ -68,7 +68,7 @@ while(<$fh>) { s/#.*$//; if (/^\s*(.*)\{\s*$/) { # Start of a section - push(@name, &split_words($1)); + push(@name, &split_quoted_string($1)); $section = { 'name' => [ @name ], 'members' => [ ], 'index' => scalar(@$addto), @@ -83,7 +83,7 @@ while(<$fh>) { elsif ((/^\s*\// || /^\s*"\//) && !$section) { # A path before a section $namestart = $lnum if (!@name); - push(@name, &split_words($_)); + push(@name, &split_quoted_string($_)); } elsif (/^\s*}\s*$/) { # End of a section @@ -160,19 +160,6 @@ if (!$argfile) { return wantarray ? (\@rv, $lnum, \@files) : \@rv; } -# split_words(string) -# Split a string like 'foo "bar" baz' into words -sub split_words -{ -my ($str) = @_; -my @rv; -while($str =~ /^\s*"(.*)"(.*)$/ || $str =~ /^\s*(\S+)(.*)$/) { - push(@rv, $1); - $str = $2; - } -return @rv; -} - # join_words(word, ...) # Joins an array of words into a string, with quotes if needed sub join_words