apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/test testuser.c
Date Wed, 21 Nov 2001 12:59:24 GMT
trawick     01/11/21 04:59:24

  Modified:    test     testuser.c
  Log:
  add some logic to sanity-check apr_get_groupid()
  
  Revision  Changes    Path
  1.4       +19 -1     apr/test/testuser.c
  
  Index: testuser.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testuser.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testuser.c	2001/08/01 21:06:26	1.3
  +++ testuser.c	2001/11/21 12:59:23	1.4
  @@ -76,7 +76,7 @@
       char *username;
       char *homedir;
       apr_uid_t userid;
  -    apr_gid_t groupid;
  +    apr_gid_t groupid, newgroupid;
   
       if (apr_initialize() != APR_SUCCESS) {
           fprintf(stderr, "Something went wrong\n");
  @@ -120,6 +120,24 @@
       rv = apr_get_groupname(&groupname, groupid, p);
       if (rv != APR_SUCCESS)
           groupname = "(none)";
  +
  +    rv = apr_get_groupid(&newgroupid, groupname, p);
  +    if (rv != APR_SUCCESS) {
  +        fprintf(stderr, "apr_get_groupid(,%s,) failed: %s\n",
  +                groupname,
  +                apr_strerror(rv, msgbuf, sizeof msgbuf));
  +        exit(-1);
  +    }
  +
  +    if (groupid != newgroupid) {
  +        fprintf(stderr, "oops, we got a different result for the "
  +                "group name/id mapping\n");
  +        /* whoever hits this problem gets to figure out how to 
  +         * portably display groupid and newgroupid :) 
  +         */
  +        fprintf(stderr, "group: %s\n",
  +                groupname);
  +    }
   
       printf("user/group ids for %s: %d/%d\n",
              username,
  
  
  

Mime
View raw message