File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,19 @@ pub fn try_init_ssl_cert_env_vars() -> bool {
6767 // we won't be overwriting existing env variables because if they're valid probe() will have
6868 // returned them unchanged
6969 if let Some ( path) = & cert_file {
70- env :: set_var ( ENV_CERT_FILE , path) ;
70+ put ( ENV_CERT_FILE , path) ;
7171 }
7272 if let Some ( path) = & cert_dir {
73- env:: set_var ( ENV_CERT_DIR , path) ;
73+ put ( ENV_CERT_DIR , path) ;
74+ }
75+
76+ fn put ( var : & str , path : & Path ) {
77+ // Avoid calling `setenv` if the variable already has the same contents. This avoids a
78+ // crash when called from out of perl <5.38 (Debian Bookworm is at 5.36), as old versions
79+ // of perl tend to manipulate the `environ` pointer directly.
80+ if env:: var_os ( var) . as_deref ( ) != Some ( path. as_os_str ( ) ) {
81+ env:: set_var ( var, path) ;
82+ }
7483 }
7584
7685 cert_file. is_some ( ) || cert_dir. is_some ( )
You can’t perform that action at this time.
0 commit comments