public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] general-functions.pl: Refactor GetCoreUpdateVersion function
@ 2026-02-18 18:13 Stefan Schantl
  0 siblings, 0 replies; only message in thread
From: Stefan Schantl @ 2026-02-18 18:13 UTC (permalink / raw)
  To: development; +Cc: Stefan Schantl

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>
---
 config/cfgroot/general-functions.pl | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl
index 1c3374d86..bcc8942c3 100644
--- a/config/cfgroot/general-functions.pl
+++ b/config/cfgroot/general-functions.pl
@@ -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;
 }
-- 
2.47.3



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-19 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-18 18:13 [PATCH] general-functions.pl: Refactor GetCoreUpdateVersion function Stefan Schantl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox