From 09d47f9d477b95382874de1233d1b012fbf4763f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 18 Sep 2020 11:59:32 +0200 Subject: [PATCH] tools: sync_mountpoint: throw actual error is syncfs fails Signed-off-by: Thomas Lamprecht --- src/PVE/Tools.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 7eb1197..7d33683 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -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 -- 2.39.2