mirror of
https://git.proxmox.com/git/perlmod
synced 2025-10-04 22:07:05 +00:00
add ffi::use_safe_putenv and glue for it
This causes changes to environment variables to leak instead of crash, which is arguably better. This will be removed (and fixed) in perl 5.38. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b425032d53
commit
e780222ea7
@ -412,6 +412,8 @@ extern "C" {
|
||||
pub fn RSPL_substr(orig: *mut SV, off: usize, len: usize) -> *mut SV;
|
||||
|
||||
pub fn RSPL_defstash() -> *mut HV;
|
||||
|
||||
pub fn RSPL_set_use_safe_putenv(on: libc::c_int);
|
||||
}
|
||||
|
||||
/// Argument marker for the stack.
|
||||
@ -577,3 +579,9 @@ where
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
/// Tell perl to use a "safe" `putenv` call instead of manually manipulating the `environ`
|
||||
/// variable. Without this, changing environment variables can lead to crashes.
|
||||
pub fn use_safe_putenv(on: bool) {
|
||||
unsafe { RSPL_set_use_safe_putenv(on as _) }
|
||||
}
|
||||
|
@ -454,6 +454,10 @@ extern HV* RSPL_defstash() {
|
||||
return PL_defstash;
|
||||
}
|
||||
|
||||
extern void RSPL_set_use_safe_putenv(int on) {
|
||||
PL_use_safe_putenv = on ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
These make are convoluted brainfarts:
|
||||
SVt_NULL undef
|
||||
|
Loading…
Reference in New Issue
Block a user