]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/Tools.pm
file_read_firstline: avoid warning with empty files
[pve-common.git] / data / PVE / Tools.pm
index 4f62cd7d2c137911a6241b33d605a09d357107c4..f962da50bda194311e68f01779480c14abe96bd4 100644 (file)
@@ -173,7 +173,7 @@ sub file_read_firstline {
     my $fh = IO::File->new ($filename, "r");
     return undef if !$fh;
     my $res = <$fh>;
-    chomp $res;
+    chomp $res if $res;
     $fh->close;
     return $res;
 }