]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
general-functions.pl: Refactor GetCoreUpdateVersion function
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 18 Feb 2026 18:13:01 +0000 (19:13 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 19 Feb 2026 15:57:14 +0000 (15:57 +0000)
There is no need for a loop when only grab the first line of a file
which only has one line. Also remove the newline from the grabbed line,
which may cause malfunctions on further processing.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index 1c3374d867ffb79120ccf55906eb28eb5e06dc2c..bcc8942c3060b3ab74f8b77f753fb6c1ed2bed92 100644 (file)
@@ -1058,11 +1058,9 @@ sub GetCoreUpdateVersion() {
        my $core_update;
 
        open(FILE, "/opt/pakfire/db/core/mine");
-       while (<FILE>) {
-               $core_update = $_;
-               last;
-       }
+       $core_update = <FILE>;
        close(FILE);
+       chomp($core_update);
 
        return $core_update;
 }