Fix deprecation warnings in openssl-sys

This commit is contained in:
Steven Fackler 2015-02-05 21:04:18 -08:00
parent 7b8aa9b915
commit d06f226b3f
3 changed files with 13 additions and 12 deletions

View File

@ -1,11 +1,11 @@
#![feature(core, collections, os)] #![feature(core, collections, env)]
extern crate "pkg-config" as pkg_config; extern crate "pkg-config" as pkg_config;
use std::os; use std::env;
fn main() { fn main() {
let target = os::getenv("TARGET").unwrap(); let target = env::var_string("TARGET").unwrap();
let is_android = target.find_str("android").is_some(); let is_android = target.find_str("android").is_some();
// Without hackory, pkg-config will only look for host libraries. // Without hackory, pkg-config will only look for host libraries.
@ -32,9 +32,10 @@ fn main() {
} }
if is_android { if is_android {
let path = os::getenv("OPENSSL_PATH").expect("Android does not provide openssl libraries, please \ let path = env::var_string("OPENSSL_PATH").ok()
build them yourselves (instructions in the README) \ .expect("Android does not provide openssl libraries, please build them yourselves \
and provide their location through $OPENSSL_PATH."); (instructions in the README) and provide their location through \
$OPENSSL_PATH.");
flags.push_str(format!(" -L {}", path).as_slice()); flags.push_str(format!(" -L {}", path).as_slice());
} }

View File

@ -1,6 +1,6 @@
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(dead_code)] #![allow(dead_code)]
#![feature(core, io, libc, os, path, std_misc)] #![feature(core, io, libc, path, std_misc, env)]
extern crate libc; extern crate libc;

View File

@ -1,4 +1,4 @@
use std::os; use std::env;
use std::old_io::fs::PathExtensions; use std::old_io::fs::PathExtensions;
pub struct ProbeResult { pub struct ProbeResult {
@ -41,17 +41,17 @@ pub fn init_ssl_cert_env_vars() {
fn put(var: &str, path: Path) { fn put(var: &str, path: Path) {
// Don't stomp over what anyone else has set // Don't stomp over what anyone else has set
match os::getenv(var) { match env::var(var) {
Some(..) => {} Some(..) => {}
None => os::setenv(var, path), None => env::set_var(var, &path),
} }
} }
} }
pub fn probe() -> ProbeResult { pub fn probe() -> ProbeResult {
let mut result = ProbeResult { let mut result = ProbeResult {
cert_file: os::getenv("SSL_CERT_FILE").map(Path::new), cert_file: env::var_string("SSL_CERT_FILE").ok().map(Path::new),
cert_dir: os::getenv("SSL_CERT_DIR").map(Path::new), cert_dir: env::var_string("SSL_CERT_DIR").ok().map(Path::new),
}; };
for certs_dir in find_certs_dirs().iter() { for certs_dir in find_certs_dirs().iter() {
// cert.pem looks to be an openssl 1.0.1 thing, while // cert.pem looks to be an openssl 1.0.1 thing, while