Fix build on FreeBSD.

Define `group_id` in the pingora-core's server daemon on FreeBSD.
This commit is contained in:
Yonas 2024-03-11 21:42:43 -04:00
parent 36e09ca389
commit df9f2da7bd

View file

@ -81,8 +81,8 @@ pub fn daemonize(conf: &ServerConf) {
Some(user) => {
let user_cstr = CString::new(user.as_str()).unwrap();
#[cfg(target_os = "macos")]
let group_id = unsafe { gid_for_username(&user_cstr).map(|gid| gid as i32) };
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
let group_id = unsafe { gid_for_username(&user_cstr).map(|gid| gid as u32) };
#[cfg(target_os = "linux")]
let group_id = unsafe { gid_for_username(&user_cstr) };