@@ -53,7 +53,7 @@ mod login {
5353 pub fn get_sessions ( ) -> Result < Vec < String > , Box < dyn std:: error:: Error > > {
5454 let mut sessions_ptr: * mut * mut libc:: c_char = ptr:: null_mut ( ) ;
5555
56- let result = unsafe { ffi:: sd_get_sessions ( & mut sessions_ptr) } ;
56+ let result = unsafe { ffi:: sd_get_sessions ( & raw mut sessions_ptr) } ;
5757
5858 if result < 0 {
5959 return Err ( format ! ( "sd_get_sessions failed: {result}" ) . into ( ) ) ;
@@ -71,11 +71,11 @@ mod login {
7171 let session_cstr = unsafe { CStr :: from_ptr ( session_ptr) } ;
7272 sessions. push ( session_cstr. to_string_lossy ( ) . into_owned ( ) ) ;
7373
74- unsafe { libc:: free ( session_ptr as * mut libc :: c_void ) } ;
74+ unsafe { libc:: free ( session_ptr. cast ( ) ) } ;
7575 i += 1 ;
7676 }
7777
78- unsafe { libc:: free ( sessions_ptr as * mut libc :: c_void ) } ;
78+ unsafe { libc:: free ( sessions_ptr. cast ( ) ) } ;
7979 }
8080
8181 Ok ( sessions)
@@ -86,7 +86,7 @@ mod login {
8686 let session_cstring = CString :: new ( session_id) ?;
8787 let mut uid: std:: os:: raw:: c_uint = 0 ;
8888
89- let result = unsafe { ffi:: sd_session_get_uid ( session_cstring. as_ptr ( ) , & mut uid) } ;
89+ let result = unsafe { ffi:: sd_session_get_uid ( session_cstring. as_ptr ( ) , & raw mut uid) } ;
9090
9191 if result < 0 {
9292 return Err (
@@ -102,7 +102,8 @@ mod login {
102102 let session_cstring = CString :: new ( session_id) ?;
103103 let mut usec: u64 = 0 ;
104104
105- let result = unsafe { ffi:: sd_session_get_start_time ( session_cstring. as_ptr ( ) , & mut usec) } ;
105+ let result =
106+ unsafe { ffi:: sd_session_get_start_time ( session_cstring. as_ptr ( ) , & raw mut usec) } ;
106107
107108 if result < 0 {
108109 return Err ( format ! (
@@ -119,7 +120,7 @@ mod login {
119120 let session_cstring = CString :: new ( session_id) ?;
120121 let mut tty_ptr: * mut libc:: c_char = ptr:: null_mut ( ) ;
121122
122- let result = unsafe { ffi:: sd_session_get_tty ( session_cstring. as_ptr ( ) , & mut tty_ptr) } ;
123+ let result = unsafe { ffi:: sd_session_get_tty ( session_cstring. as_ptr ( ) , & raw mut tty_ptr) } ;
123124
124125 if result < 0 {
125126 return Err (
@@ -134,7 +135,7 @@ mod login {
134135 let tty_cstr = unsafe { CStr :: from_ptr ( tty_ptr) } ;
135136 let tty_string = tty_cstr. to_string_lossy ( ) . into_owned ( ) ;
136137
137- unsafe { libc:: free ( tty_ptr as * mut libc :: c_void ) } ;
138+ unsafe { libc:: free ( tty_ptr. cast ( ) ) } ;
138139
139140 Ok ( Some ( tty_string) )
140141 }
@@ -147,7 +148,7 @@ mod login {
147148 let mut host_ptr: * mut libc:: c_char = ptr:: null_mut ( ) ;
148149
149150 let result =
150- unsafe { ffi:: sd_session_get_remote_host ( session_cstring. as_ptr ( ) , & mut host_ptr) } ;
151+ unsafe { ffi:: sd_session_get_remote_host ( session_cstring. as_ptr ( ) , & raw mut host_ptr) } ;
151152
152153 if result < 0 {
153154 return Err ( format ! (
@@ -163,7 +164,7 @@ mod login {
163164 let host_cstr = unsafe { CStr :: from_ptr ( host_ptr) } ;
164165 let host_string = host_cstr. to_string_lossy ( ) . into_owned ( ) ;
165166
166- unsafe { libc:: free ( host_ptr as * mut libc :: c_void ) } ;
167+ unsafe { libc:: free ( host_ptr. cast ( ) ) } ;
167168
168169 Ok ( Some ( host_string) )
169170 }
@@ -176,7 +177,7 @@ mod login {
176177 let mut display_ptr: * mut libc:: c_char = ptr:: null_mut ( ) ;
177178
178179 let result =
179- unsafe { ffi:: sd_session_get_display ( session_cstring. as_ptr ( ) , & mut display_ptr) } ;
180+ unsafe { ffi:: sd_session_get_display ( session_cstring. as_ptr ( ) , & raw mut display_ptr) } ;
180181
181182 if result < 0 {
182183 return Err ( format ! (
@@ -192,7 +193,7 @@ mod login {
192193 let display_cstr = unsafe { CStr :: from_ptr ( display_ptr) } ;
193194 let display_string = display_cstr. to_string_lossy ( ) . into_owned ( ) ;
194195
195- unsafe { libc:: free ( display_ptr as * mut libc :: c_void ) } ;
196+ unsafe { libc:: free ( display_ptr. cast ( ) ) } ;
196197
197198 Ok ( Some ( display_string) )
198199 }
@@ -204,7 +205,8 @@ mod login {
204205 let session_cstring = CString :: new ( session_id) ?;
205206 let mut type_ptr: * mut libc:: c_char = ptr:: null_mut ( ) ;
206207
207- let result = unsafe { ffi:: sd_session_get_type ( session_cstring. as_ptr ( ) , & mut type_ptr) } ;
208+ let result =
209+ unsafe { ffi:: sd_session_get_type ( session_cstring. as_ptr ( ) , & raw mut type_ptr) } ;
208210
209211 if result < 0 {
210212 return Err (
@@ -219,7 +221,7 @@ mod login {
219221 let type_cstr = unsafe { CStr :: from_ptr ( type_ptr) } ;
220222 let type_string = type_cstr. to_string_lossy ( ) . into_owned ( ) ;
221223
222- unsafe { libc:: free ( type_ptr as * mut libc :: c_void ) } ;
224+ unsafe { libc:: free ( type_ptr. cast ( ) ) } ;
223225
224226 Ok ( Some ( type_string) )
225227 }
@@ -231,7 +233,8 @@ mod login {
231233 let session_cstring = CString :: new ( session_id) ?;
232234 let mut seat_ptr: * mut libc:: c_char = ptr:: null_mut ( ) ;
233235
234- let result = unsafe { ffi:: sd_session_get_seat ( session_cstring. as_ptr ( ) , & mut seat_ptr) } ;
236+ let result =
237+ unsafe { ffi:: sd_session_get_seat ( session_cstring. as_ptr ( ) , & raw mut seat_ptr) } ;
235238
236239 if result < 0 {
237240 return Err (
@@ -246,7 +249,7 @@ mod login {
246249 let seat_cstr = unsafe { CStr :: from_ptr ( seat_ptr) } ;
247250 let seat_string = seat_cstr. to_string_lossy ( ) . into_owned ( ) ;
248251
249- unsafe { libc:: free ( seat_ptr as * mut libc :: c_void ) } ;
252+ unsafe { libc:: free ( seat_ptr. cast ( ) ) } ;
250253
251254 Ok ( Some ( seat_string) )
252255 }
@@ -373,9 +376,9 @@ pub fn read_login_records() -> UResult<Vec<SystemdLoginRecord>> {
373376 let ret = libc:: getpwuid_r (
374377 uid,
375378 passwd. as_mut_ptr ( ) ,
376- buf. as_mut_ptr ( ) as * mut libc :: c_char ,
379+ buf. as_mut_ptr ( ) . cast ( ) ,
377380 buf. len ( ) ,
378- & mut result,
381+ & raw mut result,
379382 ) ;
380383
381384 if ret == 0 && !result. is_null ( ) {
0 commit comments