@@ -41,11 +41,11 @@ use uucore::entries::{self, Group, Locate, Passwd};
4141use uucore:: error:: UResult ;
4242use uucore:: error:: { USimpleError , set_exit_code} ;
4343pub use uucore:: libc;
44- use uucore:: libc:: { getlogin, uid_t } ;
44+ use uucore:: libc:: getlogin;
4545use uucore:: line_ending:: LineEnding ;
4646use uucore:: translate;
4747
48- use uucore :: process:: { getegid, geteuid, getgid, getuid} ;
48+ use rustix :: process:: { Uid , getegid, geteuid, getgid, getuid} ;
4949use uucore:: { format_usage, show_error} ;
5050
5151macro_rules! cstr2cow {
@@ -245,7 +245,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
245245 // GNU's `id` does not support the flags: -p/-P/-A.
246246 if matches. get_flag ( options:: OPT_PASSWORD ) {
247247 // BSD's `id` ignores all but the first specified user
248- pline ( possible_pw. as_ref ( ) . map ( |v| v. uid ) ) ?;
248+ pline ( possible_pw. as_ref ( ) . map ( |v| Uid :: from_raw ( v. uid ) ) ) ?;
249249 return Ok ( ( ) ) ;
250250 }
251251 if matches. get_flag ( options:: OPT_HUMAN_READABLE ) {
@@ -263,18 +263,18 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
263263 {
264264 let use_effective = !state. rflag && ( state. uflag || state. gflag || state. gsflag ) ;
265265 if use_effective {
266- ( geteuid ( ) , getegid ( ) )
266+ ( geteuid ( ) . as_raw ( ) , getegid ( ) . as_raw ( ) )
267267 } else {
268- ( getuid ( ) , getgid ( ) )
268+ ( getuid ( ) . as_raw ( ) , getgid ( ) . as_raw ( ) )
269269 }
270270 } ,
271271 |p| ( p. uid , p. gid ) ,
272272 ) ;
273273 state. ids = Some ( Ids {
274274 uid,
275275 gid,
276- euid : geteuid ( ) ,
277- egid : getegid ( ) ,
276+ euid : geteuid ( ) . as_raw ( ) ,
277+ egid : getegid ( ) . as_raw ( ) ,
278278 } ) ;
279279
280280 if state. gflag {
@@ -499,7 +499,7 @@ fn pretty(possible_pw: Option<Passwd>) -> io::Result<()> {
499499 ) ?;
500500 } else {
501501 let login = cstr2cow ! ( getlogin( ) . cast_const( ) ) ;
502- let uid = getuid ( ) ;
502+ let uid = getuid ( ) . as_raw ( ) ;
503503 if let Ok ( p) = Passwd :: locate ( uid) {
504504 if let Some ( user_name) = login {
505505 writeln ! ( lock, "{}\t {user_name}" , translate!( "id-output-login" ) ) ?;
@@ -509,7 +509,7 @@ fn pretty(possible_pw: Option<Passwd>) -> io::Result<()> {
509509 writeln ! ( lock, "{}\t {uid}" , translate!( "id-output-uid" ) ) ?;
510510 }
511511
512- let euid = geteuid ( ) ;
512+ let euid = geteuid ( ) . as_raw ( ) ;
513513 if euid != uid {
514514 if let Ok ( p) = Passwd :: locate ( euid) {
515515 writeln ! ( lock, "{}\t {}" , translate!( "id-output-euid" ) , p. name) ?;
@@ -518,8 +518,8 @@ fn pretty(possible_pw: Option<Passwd>) -> io::Result<()> {
518518 }
519519 }
520520
521- let rgid = getgid ( ) ;
522- let egid = getegid ( ) ;
521+ let rgid = getgid ( ) . as_raw ( ) ;
522+ let egid = getegid ( ) . as_raw ( ) ;
523523 if egid != rgid {
524524 if let Ok ( g) = Group :: locate ( rgid) {
525525 writeln ! ( lock, "{}\t {}" , translate!( "id-output-rgid" ) , g. name) ?;
@@ -544,9 +544,9 @@ fn pretty(possible_pw: Option<Passwd>) -> io::Result<()> {
544544}
545545
546546#[ cfg( any( target_vendor = "apple" , target_os = "freebsd" ) ) ]
547- fn pline ( possible_uid : Option < uid_t > ) -> io:: Result < ( ) > {
547+ fn pline ( possible_uid : Option < Uid > ) -> io:: Result < ( ) > {
548548 let uid = possible_uid. unwrap_or_else ( getuid) ;
549- let pw = Passwd :: locate ( uid) ?;
549+ let pw = Passwd :: locate ( uid. as_raw ( ) ) ?;
550550
551551 writeln ! (
552552 io:: stdout( ) . lock( ) ,
@@ -571,9 +571,9 @@ fn pline(possible_uid: Option<uid_t>) -> io::Result<()> {
571571 target_os = "cygwin" ,
572572 target_os = "netbsd"
573573) ) ]
574- fn pline ( possible_uid : Option < uid_t > ) -> io:: Result < ( ) > {
574+ fn pline ( possible_uid : Option < Uid > ) -> io:: Result < ( ) > {
575575 let uid = possible_uid. unwrap_or_else ( getuid) ;
576- let pw = Passwd :: locate ( uid) ?;
576+ let pw = Passwd :: locate ( uid. as_raw ( ) ) ?;
577577
578578 writeln ! (
579579 io:: stdout( ) . lock( ) ,
0 commit comments