~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to otherlibs/unix/initgroups.c

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-04-21 21:35:08 UTC
  • mfrom: (1.1.11 upstream) (12.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110421213508-kg34453aqmb0moha
* Fixes related to -output-obj with g++ (in debian/patches):
  - add Declare-primitive-name-table-as-const-char
  - add Avoid-multiple-declarations-in-generated-.c-files-in
  - fix Embed-bytecode-in-C-object-when-using-custom: the closing
    brace for extern "C" { ... } was missing in some cases

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************/
 
2
/*                                                                     */
 
3
/*                           Objective Caml                            */
 
4
/*                                                                     */
 
5
/*  Copyright 2009 Institut National de Recherche en Informatique et   */
 
6
/*  en Automatique.  All rights reserved.  This file is distributed    */
 
7
/*  under the terms of the GNU Library General Public License, with    */
 
8
/*  the special exception on linking described in file ../../LICENSE.  */
 
9
/*                                                                     */
 
10
/***********************************************************************/
 
11
 
 
12
/* Contributed by Stephane Glondu <steph@glondu.net> */
 
13
 
 
14
/* $Id: initgroups.c 9235 2009-04-16 07:23:35Z xleroy $ */
 
15
 
 
16
#include <mlvalues.h>
 
17
#include <alloc.h>
 
18
#include <fail.h>
 
19
 
 
20
#ifdef HAS_INITGROUPS
 
21
 
 
22
#include <sys/types.h>
 
23
#ifdef HAS_UNISTD
 
24
#include <unistd.h>
 
25
#endif
 
26
#include <limits.h>
 
27
#include <grp.h>
 
28
#include "unixsupport.h"
 
29
 
 
30
CAMLprim value unix_initgroups(value user, value group)
 
31
{
 
32
  if (initgroups(String_val(user), Int_val(group)) == -1) {
 
33
    uerror("initgroups", Nothing);
 
34
  }
 
35
  return Val_unit;
 
36
}
 
37
 
 
38
#else
 
39
 
 
40
CAMLprim value unix_initgroups(value user, value group)
 
41
{ invalid_argument("initgroups not implemented"); }
 
42
 
 
43
#endif