]> 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 403249b57577c643955e036695b88b6b8365a2d5..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;
 }
@@ -230,7 +230,7 @@ sub run_command {
            if ($p eq 'timeout') {
                $timeout = $param{$p};
            } elsif ($p eq 'umask') {
-               umask($param{$p});
+               $old_umask = umask($param{$p});
            } elsif ($p eq 'errmsg') {
                $errmsg = $param{$p};
            } elsif ($p eq 'input') {