Deleted Added
full compact
initgroups.c (1574) initgroups.c (11659)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
37
38#include <sys/param.h>
39
40#include <stdio.h>
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 24 unchanged lines hidden (view full) ---

33
34#if defined(LIBC_SCCS) && !defined(lint)
35static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93";
36#endif /* LIBC_SCCS and not lint */
37
38#include <sys/param.h>
39
40#include <stdio.h>
41#include <err.h>
41
42int
43initgroups(uname, agroup)
44 const char *uname;
45 int agroup;
46{
47 int groups[NGROUPS], ngroups;
48
49 ngroups = NGROUPS;
50 if (getgrouplist(uname, agroup, groups, &ngroups) < 0)
51 warnx("%s is in too many groups, using first %d",
52 uname, ngroups);
53 if (setgroups(ngroups, groups) < 0) {
54 warn("setgroups");
55 return (-1);
56 }
57 return (0);
58}
42
43int
44initgroups(uname, agroup)
45 const char *uname;
46 int agroup;
47{
48 int groups[NGROUPS], ngroups;
49
50 ngroups = NGROUPS;
51 if (getgrouplist(uname, agroup, groups, &ngroups) < 0)
52 warnx("%s is in too many groups, using first %d",
53 uname, ngroups);
54 if (setgroups(ngroups, groups) < 0) {
55 warn("setgroups");
56 return (-1);
57 }
58 return (0);
59}