Commit d06f226b authored by Steven Fackler's avatar Steven Fackler
Browse files

Fix deprecation warnings in openssl-sys

parent 7b8aa9b9
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
#![feature(core, collections, os)]
#![feature(core, collections, env)]

extern crate "pkg-config" as pkg_config;

use std::os;
use std::env;

fn main() {
    let target = os::getenv("TARGET").unwrap();
    let target = env::var_string("TARGET").unwrap();
    let is_android = target.find_str("android").is_some();

    // Without hackory, pkg-config will only look for host libraries.
@@ -32,9 +32,10 @@ fn main() {
        }

        if is_android {
            let path = os::getenv("OPENSSL_PATH").expect("Android does not provide openssl libraries, please \
                                                          build them yourselves (instructions in the README) \
                                                          and provide their location through $OPENSSL_PATH.");
            let path = env::var_string("OPENSSL_PATH").ok()
                .expect("Android does not provide openssl libraries, please build them yourselves \
                         (instructions in the README) and provide their location through \
                         $OPENSSL_PATH.");
            flags.push_str(format!(" -L {}", path).as_slice());
        }

+1 −1
Original line number Diff line number Diff line
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(dead_code)]
#![feature(core, io, libc, os, path, std_misc)]
#![feature(core, io, libc, path, std_misc, env)]

extern crate libc;

+5 −5
Original line number Diff line number Diff line
use std::os;
use std::env;
use std::old_io::fs::PathExtensions;

pub struct ProbeResult {
@@ -41,17 +41,17 @@ pub fn init_ssl_cert_env_vars() {

    fn put(var: &str, path: Path) {
        // Don't stomp over what anyone else has set
        match os::getenv(var) {
        match env::var(var) {
            Some(..) => {}
            None => os::setenv(var, path),
            None => env::set_var(var, &path),
        }
    }
}

pub fn probe() -> ProbeResult {
    let mut result = ProbeResult {
        cert_file: os::getenv("SSL_CERT_FILE").map(Path::new),
        cert_dir: os::getenv("SSL_CERT_DIR").map(Path::new),
        cert_file: env::var_string("SSL_CERT_FILE").ok().map(Path::new),
        cert_dir: env::var_string("SSL_CERT_DIR").ok().map(Path::new),
    };
    for certs_dir in find_certs_dirs().iter() {
        // cert.pem looks to be an openssl 1.0.1 thing, while