Fix user-name in unix.users, add unit test
parent
60561dd490
commit
c32fcf918b
|
@ -59,7 +59,7 @@ PRIVATE>
|
|||
[ nip ] [ number>string ] if* ;
|
||||
|
||||
: group-id ( string -- id/f )
|
||||
group-struct [ gr_gid>> ] [ f ] if* ;
|
||||
group-struct dup [ gr_gid>> ] when ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
|
|
|
@ -25,3 +25,5 @@ IN: unix.users.tests
|
|||
[ "9999999999999999999" ] [ 9999999999999999999 user-name ] unit-test
|
||||
|
||||
[ f ] [ 89898989898989898989898989898 user-passwd ] unit-test
|
||||
|
||||
[ f ] [ "thisusershouldnotexistabcdefg12345asdfasdfasdfasdfasdfasdfasdf" user-id ] unit-test
|
||||
|
|
|
@ -61,8 +61,8 @@ M: string user-passwd ( string -- passwd/f )
|
|||
dup user-passwd
|
||||
[ nip user-name>> ] [ number>string ] if* ;
|
||||
|
||||
: user-id ( string -- id )
|
||||
user-passwd uid>> ;
|
||||
: user-id ( string -- id/f )
|
||||
user-passwd dup [ uid>> ] when ;
|
||||
|
||||
: real-user-id ( -- id )
|
||||
unix.ffi:getuid ; inline
|
||||
|
|
Loading…
Reference in New Issue