Changeset 1782:95be6b012d32 in roaraudio


Ignore:
Timestamp:
05/19/09 20:23:17 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

only use try to get user/group names if possible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarctl.c

    r1781 r1782  
    2424 
    2525#include <roaraudio.h> 
     26 
     27#if defined(ROAR_HAVE_SETGID) && defined(ROAR_HAVE_SETUID) 
     28#define _POSIX_USERS 
     29#endif 
     30 
     31#ifdef _POSIX_USERS 
    2632#include <pwd.h> 
    2733#include <grp.h> 
     34#endif 
     35 
    2836#include <sys/time.h> 
    2937#include <time.h> 
     
    184192 int id[ROAR_CLIENTS_MAX]; 
    185193 struct roar_client c; 
     194#ifdef _POSIX_USERS 
    186195 struct group  * grp = NULL; 
    187196 struct passwd * pwd = NULL; 
     197#endif 
    188198 
    189199 if ( (num = roar_list_clients(con, id, ROAR_CLIENTS_MAX)) == -1 ) { 
     
    201211  printf("Player PID            : %i(%s)\n", c.pid, proc_name(c.pid)); 
    202212  if ( c.uid != -1 ) { 
     213#ifdef _POSIX_USERS 
    203214   pwd = getpwuid(c.uid); 
    204215   grp = getgrgid(c.gid); 
    205216   printf("Player UID/GID        : %i(%s)/%i(%s)\n", c.uid, pwd ? pwd->pw_name : "?", c.gid, grp ? grp->gr_name : "?"); 
     217#else 
     218   printf("Player UID/GID        : %i/%i\n", c.uid, c.gid); 
     219#endif 
    206220  } 
    207221  if ( c.execed != -1 ) 
Note: See TracChangeset for help on using the changeset viewer.