Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix FreeBSD build
Shawn Webb committed 2 years ago
commit cff26ff44fad987d34044c0294da0ff4b0fa69bc
parent 36c10fac855f5a25627f8f9b68e86bfb4800e3a4
2 files changed +5 -5
modified radicle-httpd/src/commands/web.rs
@@ -192,7 +192,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
    }

    if options.open {
-
        #[cfg(target_os = "windows")]
+
        #[cfg(target_os = "freebsd")]
        let cmd_name = "echo";
        #[cfg(target_os = "macos")]
        let cmd_name = "open";
modified radicle/src/io.rs
@@ -3,7 +3,7 @@ use std::io;

use libc::{getrlimit, rlimit, setrlimit, RLIMIT_NOFILE};

-
#[cfg(target_family = "unix")]
+
#[cfg(not(target_os = "freebsd"))]
/// Sets the open file limit to the given value, or the maximum allowed value.
pub fn set_file_limit<N>(n: N) -> io::Result<u64>
where
@@ -39,15 +39,15 @@ where
    Ok(rlim.rlim_cur)
}

-
// N.b. windows uses i64 instead of u64
-
#[cfg(target_family = "windows")]
+
// FreeBSD uses i64 instead of u64
+
#[cfg(target_os = "freebsd")]
/// Sets the open file limit to the given value, or the maximum allowed value.
pub fn set_file_limit<N>(n: N) -> io::Result<i64>
where
    N: Copy + fmt::Display,
    i64: TryFrom<N>,
{
-
    let Ok(n) = u64::try_from(n) else {
+
    let Ok(n) = i64::try_from(n) else {
        return Err(io::Error::new(
            io::ErrorKind::InvalidInput,
            format!("expected value that fits into i64, found: {n}"),