source: rtems/cpukit/libcsupport/src/uenvgetgroups.c @ b8bd90f6

4.115
Last change on this file since b8bd90f6 was b8bd90f6, checked in by Sebastian Huber <sebastian.huber@…>, on 11/17/14 at 08:01:53

Add supplementary groups to user environment

  • Property mode set to 100644
File size: 793 bytes
Line 
1/*
2 * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
3 *
4 * embedded brains GmbH
5 * Dornierstr. 4
6 * D-82178 Puchheim
7 * Germany
8 * <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/userenv.h>
20#include <rtems.h>
21
22#include <sys/types.h>
23#include <unistd.h>
24
25void rtems_current_user_env_getgroups(void)
26{
27  rtems_user_env_t *uenv = rtems_current_user_env_get();
28  int ngroups = (int) RTEMS_ARRAY_SIZE( uenv->groups );
29
30  ngroups = getgroups( ngroups, &uenv->groups[ 0 ] );
31  if ( ngroups > 0 ) {
32    uenv->ngroups = (size_t) ngroups;
33  } else {
34    uenv->ngroups = 0;
35  }
36}
Note: See TracBrowser for help on using the repository browser.