[pve-devel] [PATCH pve-common 1/2] Tools: make unshare behave like other perl syscalls

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Oct 30 10:31:00 CET 2015


Most syscall wrappers in perl return 1 on success and our
current use of Tools::unshare isn't using the return value
(yet), so let's fix this while we can.

Also it seems to make sense to use prototyping on syscalls
to add some compile-time argument checking.
---
 src/PVE/Tools.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index c52a3d0..b6849f2 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1169,9 +1169,9 @@ sub parse_host_and_port {
     return; # nothing
 }
 
-sub unshare {
+sub unshare($) {
     my ($flags) = @_;
-    syscall 272, $flags;
+    return 0 == syscall(272, $flags);
 }
 
 1;
-- 
2.1.4





More information about the pve-devel mailing list