skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

trygetpeerucred.c (309B)


      1 /* ISC license. */
      2 
      3 #undef _POSIX_C_SOURCE
      4 #undef _XOPEN_SOURCE
      5 
      6 #include <sys/types.h>
      7 #include <ucred.h>
      8 
      9 int main (void)
     10 {
     11   ucred_t *cred ;
     12   uid_t uid ;
     13   gid_t gid ;
     14   int s = 0 ;
     15   getpeerucred(s, &cred) ;
     16   uid = ucred_geteuid(cred) ;
     17   gid = ucred_getegid(cred) ;
     18   ucred_free(cred) ;
     19   return 0 ;
     20 }