general-functions.pl: Refactor GetCoreUpdateVersion function
Commit Message
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(-)
@@ -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;
}