mirror of
https://git.proxmox.com/git/proxmox
synced 2025-04-28 11:44:39 +00:00
mark extern C blocks as unsafe
This is required in edition 2024. Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
a75b97da76
commit
abd07ffcff
@ -385,7 +385,7 @@ fn x509name_to_string(name: &openssl::x509::X509NameRef) -> Result<String, Error
|
|||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
type ASN1_TIME = <openssl::asn1::Asn1TimeRef as ForeignTypeRef>::CType;
|
type ASN1_TIME = <openssl::asn1::Asn1TimeRef as ForeignTypeRef>::CType;
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn ASN1_TIME_to_tm(s: *const ASN1_TIME, tm: *mut libc::tm) -> libc::c_int;
|
fn ASN1_TIME_to_tm(s: *const ASN1_TIME, tm: *mut libc::tm) -> libc::c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ use tokio::runtime::{self, Runtime, RuntimeFlavor};
|
|||||||
static RUNTIME: LazyLock<Mutex<Weak<Runtime>>> = LazyLock::new(|| Mutex::new(Weak::new()));
|
static RUNTIME: LazyLock<Mutex<Weak<Runtime>>> = LazyLock::new(|| Mutex::new(Weak::new()));
|
||||||
|
|
||||||
#[link(name = "crypto")]
|
#[link(name = "crypto")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn OPENSSL_thread_stop();
|
fn OPENSSL_thread_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ use crate::{
|
|||||||
formatter::*, normalize_path, ApiConfig, AuthError, CompressionMethod, RestEnvironment,
|
formatter::*, normalize_path, ApiConfig, AuthError, CompressionMethod, RestEnvironment,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn tzset();
|
fn tzset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ struct CryptData {
|
|||||||
/// Encrypt a password - see man crypt(3)
|
/// Encrypt a password - see man crypt(3)
|
||||||
pub fn crypt(password: &[u8], salt: &[u8]) -> Result<String, Error> {
|
pub fn crypt(password: &[u8], salt: &[u8]) -> Result<String, Error> {
|
||||||
#[link(name = "crypt")]
|
#[link(name = "crypt")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
#[link_name = "crypt_r"]
|
#[link_name = "crypt_r"]
|
||||||
fn __crypt_r(
|
fn __crypt_r(
|
||||||
key: *const libc::c_char,
|
key: *const libc::c_char,
|
||||||
@ -87,7 +87,7 @@ pub fn crypt(password: &[u8], salt: &[u8]) -> Result<String, Error> {
|
|||||||
/// - `rbytes`: The byte slice that contains cryptographically random bytes for generating the salt
|
/// - `rbytes`: The byte slice that contains cryptographically random bytes for generating the salt
|
||||||
pub fn crypt_gensalt(prefix: &str, count: u64, rbytes: &[u8]) -> Result<String, Error> {
|
pub fn crypt_gensalt(prefix: &str, count: u64, rbytes: &[u8]) -> Result<String, Error> {
|
||||||
#[link(name = "crypt")]
|
#[link(name = "crypt")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
#[link_name = "crypt_gensalt_rn"]
|
#[link_name = "crypt_gensalt_rn"]
|
||||||
fn __crypt_gensalt_rn(
|
fn __crypt_gensalt_rn(
|
||||||
prefix: *const libc::c_char,
|
prefix: *const libc::c_char,
|
||||||
|
@ -54,7 +54,7 @@ mod constants {
|
|||||||
pub use constants::*;
|
pub use constants::*;
|
||||||
|
|
||||||
#[link(name = "acl")]
|
#[link(name = "acl")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn acl_get_file(path: *const c_char, acl_type: ACLType) -> *mut c_void;
|
fn acl_get_file(path: *const c_char, acl_type: ACLType) -> *mut c_void;
|
||||||
fn acl_set_file(path: *const c_char, acl_type: ACLType, acl: *mut c_void) -> c_int;
|
fn acl_set_file(path: *const c_char, acl_type: ACLType, acl: *mut c_void) -> c_int;
|
||||||
fn acl_get_fd(fd: RawFd) -> *mut c_void;
|
fn acl_get_fd(fd: RawFd) -> *mut c_void;
|
||||||
|
@ -20,7 +20,7 @@ pub use mountinfo::MountInfo;
|
|||||||
|
|
||||||
/// POSIX sysconf call
|
/// POSIX sysconf call
|
||||||
pub fn sysconf(name: i32) -> i64 {
|
pub fn sysconf(name: i32) -> i64 {
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn sysconf(name: i32) -> i64;
|
fn sysconf(name: i32) -> i64;
|
||||||
}
|
}
|
||||||
unsafe { sysconf(name) }
|
unsafe { sysconf(name) }
|
||||||
|
@ -70,7 +70,7 @@ type TimerT = *mut InternalTimerT;
|
|||||||
|
|
||||||
// These wrappers are defined in -lrt.
|
// These wrappers are defined in -lrt.
|
||||||
#[link(name = "rt")]
|
#[link(name = "rt")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn timer_create(clockid: clockid_t, evp: *mut libc::sigevent, timer: *mut TimerT) -> c_int;
|
fn timer_create(clockid: clockid_t, evp: *mut libc::sigevent, timer: *mut TimerT) -> c_int;
|
||||||
fn timer_delete(timer: TimerT) -> c_int;
|
fn timer_delete(timer: TimerT) -> c_int;
|
||||||
fn timer_settime(
|
fn timer_settime(
|
||||||
@ -232,7 +232,7 @@ pub const SIGTIMEOUT: Signal = Signal(32 + 4);
|
|||||||
|
|
||||||
// Our timeout handler does exactly nothing. We only need it to interrupt
|
// Our timeout handler does exactly nothing. We only need it to interrupt
|
||||||
// system calls.
|
// system calls.
|
||||||
extern "C" fn sig_timeout_handler(_: c_int) {}
|
unsafe extern "C" fn sig_timeout_handler(_: c_int) {}
|
||||||
|
|
||||||
// See setup_timeout_handler().
|
// See setup_timeout_handler().
|
||||||
fn do_setup_timeout_handler() -> io::Result<()> {
|
fn do_setup_timeout_handler() -> io::Result<()> {
|
||||||
|
@ -5,7 +5,7 @@ use std::os::fd::RawFd;
|
|||||||
pub const LISTEN_FDS_START: RawFd = 3;
|
pub const LISTEN_FDS_START: RawFd = 3;
|
||||||
|
|
||||||
#[link(name = "systemd")]
|
#[link(name = "systemd")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn sd_journal_stream_fd(
|
pub fn sd_journal_stream_fd(
|
||||||
identifier: *const c_uchar,
|
identifier: *const c_uchar,
|
||||||
priority: c_int,
|
priority: c_int,
|
||||||
|
@ -142,7 +142,7 @@ pub fn strftime(format: &str, t: &libc::tm) -> Result<String, Error> {
|
|||||||
|
|
||||||
// The `libc` crate does not yet contain bindings for `strftime_l`
|
// The `libc` crate does not yet contain bindings for `strftime_l`
|
||||||
#[link(name = "c")]
|
#[link(name = "c")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
#[link_name = "strftime_l"]
|
#[link_name = "strftime_l"]
|
||||||
fn libc_strftime_l(
|
fn libc_strftime_l(
|
||||||
s: *mut libc::c_char,
|
s: *mut libc::c_char,
|
||||||
|
@ -3,7 +3,7 @@ use std::fmt;
|
|||||||
use crate::Uuid;
|
use crate::Uuid;
|
||||||
|
|
||||||
#[link(name = "uuid")]
|
#[link(name = "uuid")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn uuid_generate(out: *mut [u8; 16]);
|
pub fn uuid_generate(out: *mut [u8; 16]);
|
||||||
fn uuid_unparse_lower(input: *const [u8; 16], out: *mut u8);
|
fn uuid_unparse_lower(input: *const [u8; 16], out: *mut u8);
|
||||||
fn uuid_unparse_upper(input: *const [u8; 16], out: *mut u8);
|
fn uuid_unparse_upper(input: *const [u8; 16], out: *mut u8);
|
||||||
|
Loading…
Reference in New Issue
Block a user