]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/Tools.pm
PBS client: cannot use normal method call style for private subs
[pve-common.git] / src / PVE / Tools.pm
index 7eb1197e2b4090e6a6de765a0024c93b8693dd21..4b445eafa784d526250e7632d93f02158645b8a7 100644 (file)
@@ -1434,9 +1434,12 @@ sub fsync($) {
 sub sync_mountpoint {
     my ($path) = @_;
     sysopen my $fd, $path, O_RDONLY|O_CLOEXEC or die "failed to open $path: $!\n";
-    my $result = syncfs(fileno($fd));
+    my $syncfs_err;
+    if (!syncfs(fileno($fd))) {
+       $syncfs_err = "$!";
+    }
     close($fd);
-    return $result;
+    die "syncfs '$path' failed - $syncfs_err\n" if defined $syncfs_err;
 }
 
 # support sending multi-part mail messages with a text and or a HTML part
@@ -1447,16 +1450,14 @@ sub sendmail {
 
     $mailto = [ $mailto ] if !ref($mailto);
 
-    foreach (@$mailto) {
-       die "illegal character in mailto address\n"
-           if ($_ =~ $mail_re);
+    for my $to (@$mailto) {
+       die "illegal character in mailto address\n" if $to =~ $mail_re;
     }
 
     my $rcvrtxt = join (', ', @$mailto);
 
     $mailfrom = $mailfrom || "root";
-    die "illegal character in mailfrom address\n"
-       if $mailfrom =~ $mail_re;
+    die "illegal character in mailfrom address\n" if $mailfrom =~ $mail_re;
 
     $author = $author // 'Proxmox VE';