Proper return values from XS, and code should work
This commit is contained in:
parent
9cac842191
commit
1023bb6f38
3 changed files with 19 additions and 11 deletions
|
@ -12,11 +12,7 @@ PROTOTYPES: ENABLE
|
||||||
# XS comments begin with " #" to avoid them being interpreted as pre-processor
|
# XS comments begin with " #" to avoid them being interpreted as pre-processor
|
||||||
# directives
|
# directives
|
||||||
|
|
||||||
int _mount_sys(source, target, filesystem, mountflags, data)
|
SV *_mount_sys(const char *source, const char *target, const char *filesystem, unsigned long mountflags, const char *data)
|
||||||
const char *source
|
|
||||||
const char *target
|
|
||||||
const char *filesystem
|
|
||||||
unsigned long mountflags
|
|
||||||
const char *data
|
|
||||||
CODE:
|
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));
|
||||||
|
|
|
@ -15,9 +15,8 @@ PROTOTYPES: ENABLE
|
||||||
# XS comments begin with " #" to avoid them being interpreted as pre-processor
|
# XS comments begin with " #" to avoid them being interpreted as pre-processor
|
||||||
# directives
|
# directives
|
||||||
|
|
||||||
int
|
SV * _unshare_sys(int flags)
|
||||||
_unshare_sys(flags)
|
|
||||||
int flags
|
|
||||||
CODE:
|
CODE:
|
||||||
RETVAL = unshare(flags);
|
ST(0) = sv_newmortal();
|
||||||
|
sv_setiv(ST(0), unshare(flags));
|
||||||
|
|
||||||
|
|
13
t/02-namespace.t
Normal file
13
t/02-namespace.t
Normal file
|
@ -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");
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue