diff --git a/lib/Sys/Linux/Mount.xs b/lib/Sys/Linux/Mount.xs index 7a8faa2..6358fb7 100644 --- a/lib/Sys/Linux/Mount.xs +++ b/lib/Sys/Linux/Mount.xs @@ -12,11 +12,7 @@ PROTOTYPES: ENABLE # XS comments begin with " #" to avoid them being interpreted as pre-processor # directives -int _mount_sys(source, target, filesystem, mountflags, data) -const char *source -const char *target -const char *filesystem -unsigned long mountflags -const char *data +SV *_mount_sys(const char *source, const char *target, const char *filesystem, unsigned long mountflags, const char *data) CODE: - RETVAL = mount(source, target, filesystem, mountflags, (const void *) data); + ST(0) = sv_newmortal(); + sv_setiv(ST(0), mount(source, target, filesystem, mountflags, (const void *) data)); diff --git a/lib/Sys/Linux/Unshare.xs b/lib/Sys/Linux/Unshare.xs index 0be72ed..3379b3e 100644 --- a/lib/Sys/Linux/Unshare.xs +++ b/lib/Sys/Linux/Unshare.xs @@ -15,9 +15,8 @@ PROTOTYPES: ENABLE # XS comments begin with " #" to avoid them being interpreted as pre-processor # directives -int -_unshare_sys(flags) -int flags +SV * _unshare_sys(int flags) CODE: - RETVAL = unshare(flags); + ST(0) = sv_newmortal(); + sv_setiv(ST(0), unshare(flags)); diff --git a/t/02-namespace.t b/t/02-namespace.t new file mode 100644 index 0000000..5d034c9 --- /dev/null +++ b/t/02-namespace.t @@ -0,0 +1,13 @@ +use Test::More tests => 3; + +# test 1 +use_ok("Sys::Linux::Namespace", 'namespace'); + +# test 2 +SKIP: { + skip "Need to be root to run test", 2 unless $< == 0; + ok(namespace({private_tmp => 1}), "Setup private /tmp"); + + # tmp is empty + is_deeply([glob "/tmp/*"], [], "/tmp is empty afterwards"); +}