summaryrefslogtreecommitdiff
path: root/lib/getugroups.c
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-common.m4: Use C2x [[maybe_unused]] when possible.Bruno Haible2021-08-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of _GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED. * lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the declaration. * lib/c-stack.c (null_action, segv_handler, overflow_handler, c_stack_action): Likewise. * lib/chown.c (chown): Likewise. * lib/clean-temp-simple.c (cleanup_action): Likewise. * lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization, fts_set): Likewise. * lib/getgroups.c (getgroups): Likewise. * lib/getopt.c (_getopt_initialize): Likewise. * lib/getugroups.c (getugroups): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread, gl_locale_name_posix, gl_locale_name_environ): Likewise. * lib/mkdir.c (rpl_mkdir): Likewise. * lib/mkfifo.c (mkfifo): Likewise. * lib/mkfifoat.c (mkfifoat): Likewise. * lib/mknod.c (mknod): Likewise. * lib/mknodat.c (mknodat): Likewise. * lib/mountlist.c (me_remote): Likewise. * lib/openpty.c (openpty): Likewise. * lib/parse-datetime.y (yyerror): Likewise. * lib/passfd.c (sendfd, recvfd): Likewise. * lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_destroy): Likewise. * lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock, pthread_mutex_unlock, pthread_mutex_destroy): Likewise. * lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise. * lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy): Likewise. * lib/pthread-thread.c (pthread_attr_destroy): Likewise. * lib/readlink.c (readlink): Likewise. * lib/rename.c (rpl_rename): Likewise. * lib/set-permissions.c (set_permissions): Likewise. * lib/sockets.c (gl_sockets_startup): Likewise. * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime, stat_time_normalize): Likewise. * lib/strptime.c (__strptime_internal): Likewise. * lib/strtod.c (LDEXP): Likewise. * lib/symlink.c (symlink): Likewise. * lib/symlinkat.c (symlinkat): Likewise. * lib/tempname.c (try_dir, try_nocreate): Likewise. * lib/textstyle.in.h (styled_ostream_begin_use_class, styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref, styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink, styled_ostream_flush_to_current_style, fd_ostream_create, term_ostream_get_color, term_ostream_set_color, term_ostream_get_bgcolor, term_ostream_set_bgcolor, term_ostream_get_weight, term_ostream_set_weight, term_ostream_get_posture, term_ostream_set_posture, term_ostream_get_underline, term_ostream_set_underline, term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id, term_ostream_set_hyperlink, term_ostream_create, term_styled_ostream_create, html_styled_ostream_create, handle_color_option, handle_style_option, style_file_prepare, styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise. * lib/unicodeio.c (exit_failure_callback, fallback_failure_callback): Likewise. * lib/wait-process.c (cleanup_slaves_action): Likewise. * tests/signature.h (SIGNATURE_CHECK2): Likewise. * tests/test-areadlink.c (do_areadlink): Likewise. * tests/test-areadlinkat.c (do_areadlinkat): Likewise. * tests/test-ceilf-ieee.c (main): Likewise. * tests/test-ceilf1.c (main): Likewise. * tests/test-dirent.c (dir): Likewise. * tests/test-fchownat.c (main): Likewise. * tests/test-fdopendir.c (main): Likewise. * tests/test-filenamecat.c (main): Likewise. * tests/test-floor1.c (main): Likewise. * tests/test-floorf-ieee.c (main): Likewise. * tests/test-floorf1.c (main): Likewise. * tests/test-fseeko.c (main): Likewise. * tests/test-fstatat.c (main): Likewise. * tests/test-ftello.c (main): Likewise. * tests/test-getdomainname.c (main): Likewise. * tests/test-getgroups.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise. * tests/test-mkdirat.c (main): Likewise. * tests/test-openat.c (main): Likewise. * tests/test-parse-datetime.c (main): Likewise. * tests/test-quotearg-simple.c (main): Likewise. * tests/test-quotearg.c (main): Likewise. * tests/test-sethostname2.c (main): Likewise. * tests/test-unlinkat.c (main): Likewise. * tests/test-version-etc.c (main): Likewise. * tests/test-xalloc-die.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (main): Likewise.
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-041-7/+7
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* getugroups: Fix Android buildKevin Cernekee2015-02-111-2/+5
| | | | | * lib/getugroups.c: Don't reference unsupported {get,set,end}grent functions.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* In commentary, do not use ` to quote.Paul Eggert2012-01-051-1/+1
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* define STREQ(a,b) consistently, removing useless parenthesesJim Meyering2010-01-241-1/+1
| | | | | | | | | | | #define STREQ(a, b) (strcmp ((a), (b)) == 0) is over-parenthesized, since the only risk is that "a" or "b" contains an unparenthesized comma, but if either did that, STREQ would have 3 or more arguments. Hence, #define STREQ(a, b) (strcmp (a, b) == 0) is better. * lib/fts.c (STREQ): Remove unnecessary parentheses. * lib/hash-triple.c (STREQ): Likewise. * tests/test-argv-iter.c (STREQ): Use a and b, not s1 and s2. * lib/getugroups.c (STREQ): Likewise.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* maint: use consistent FSF copyright line syntaxJim Meyering2009-12-281-1/+1
| | | | | | * lib/posixtm.c: Add missing comma in FSF copyright line. * lib/posixtm.h: Likewise. * lib/getugroups.c: Add missing ", Inc.".
* gnulib-common: prefer _GL_UNUSED over _UNUSED_PARAMETER_Eric Blake2009-12-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are more contexts where __attribute__((__unused__)) is useful than just parameter lists. Also, naming the macro _GL_UNUSED fits with the recent addition of _GL_ARG_NONNULL. Preserve the name _UNUSED_PARAMETER_ for backwards-compatible use in external projects. * m4/gnulib-common.m4 (gl_COMMON): Create a more-appropriately named alias for __attribute__((__unused__)). * lib/chown.c: Update client. * lib/fchmodat.c: Likewise. * lib/fts.c: Likewise. * lib/getdate.y: Likewise. * lib/getgroups.c: Likewise. * lib/getopt.c: Likewise. * lib/getugroups.c: Likewise. * lib/mkdir.c: Likewise. * lib/mkfifo.c: Likewise. * lib/mkfifoat.c: Likewise. * lib/mknod.c: Likewise. * lib/mknodat.c: Likewise. * lib/readlink.c: Likewise. * lib/se-context.in.h: Likewise. * lib/se-selinux.in.h: Likewise. * lib/sockets.c: Likewise. * lib/symlink.c: Likewise. * lib/symlinkat.c: Likewise. * lib/unicodeio.c: Likewise. * lib/unistr.h: Likewise. * tests/test-areadlink.c: Likewise. * tests/test-areadlinkat.c: Likewise. * tests/test-filenamecat.c: Likewise. * tests/test-fseeko.c: Likewise. * tests/test-ftello.c: Likewise. * tests/test-getdate.c: Likewise. * tests/test-getgroups.c: Likewise. * tests/test-gethostname.c: Likewise. * tests/test-quotearg.c: Likewise. * tests/test-version-etc.c: Likewise. * tests/test-xalloc-die.c: Likewise. * tests/test-xfprintf-posix.c: Likewise. * tests/test-xprintf-posix.c: Likewise. * tests/test-xvasprintf.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-31/+31
|
* getgroups: don't expose GETGROUPS_T to userEric Blake2009-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These days, most systems already declare getgroups with gid_t*. But in the rare case that GETGROUPS_T is still int but gid_t is short, the user should not have to uglify their code; let the replacement hide all the magic. Tested by configuring with ac_cv_type_getgroups=uint64_t on a platform with 32-bit gid_t, and ignoring compiler warnings. However, since we don't replace setgroups, the GETGROUPS_T workaround is still needed there for now. * lib/getgroups.c (rpl_getgroups): Change signature. Copy array an element at a time if GETGROUPS_T is wrong size. * lib/getugroups.h (getugroups): Change signature. * lib/unistd.in.h (getgroups): Likewise. * m4/getgroups.m4 (gl_FUNC_GETGROUPS): Use replacement if signature needs fixing. * m4/getugroups.m4 (gl_GETUGROUPS): No longer need AC_TYPE_GETGROUPS. * modules/group-member (Depends-on): Add getgroups. * lib/group-member.c (group_info, get_group_info): Use gid_t. (group_member): Rely on getgroups replacement. * lib/getugroups.c (getugroups): Use gid_t. * tests/test-getgroups.c (main): Likewise. * NEWS: Mention the signature change. * doc/posix-functions/getgroups.texi (getgroups): Mention the problem with signature. * doc/glibc-functions/setgroups.texi (setgroups): Mention that GETGROUPS_T is still useful for setgroups. Signed-off-by: Eric Blake <ebb9@byu.net>
* getgroups, getugroups: provide stubs for mingwEric Blake2009-11-131-9/+20
| | | | | | | | | | | | | | | | | | Avoid link failure on mingw, which lacks getgroups and anything else related to gid_t management (stat.st_gid is always 0). * lib/getgroups.c (getgroups): Provide ENOSYS stub for mingw. * lib/getugroups.c (getugroups): Likewise. * m4/getgroups.m4 (gl_FUNC_GETGROUPS): Check for missing function. Modernize replacement scheme. (gl_PREREQ_GETGROUPS): Delete. * m4/getugroups.m4 (gl_GETUGROUPS): Check for <grp.h>. * modules/getgroups (configure.ac): Declare witness. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default. * modules/unistd (Depends-on): Substitute witness. * lib/unistd.in.h (getgroups): Declare replacement. Signed-off-by: Eric Blake <ebb9@byu.net>
* remove superfluous parentheses in STREQ definitionJim Meyering2009-07-051-2/+2
| | | | | | | * tests/test-argv-iter.c (STREQ): Remove redundant parentheses. * lib/getugroups.c (STREQ): Likewise. * lib/fnmatch.c (STREQ): Likewise. Spotted by Bruno Haible.
* avoid misc. warningsJim Meyering2009-02-041-1/+1
| | | | | | | | | | * lib/fsusage.c (UNUSED_PARAM): Define. (get_fs_usage): Mark parameter "disk" as unused. * lib/getugroups.c (getgrent): Use "void" in prototype. * lib/mountlist.c: Mark unused parameters. (read_file_system_list): Declare a local with "const". * lib/nanosleep.c (getnow): Declare static. * lib/strftime.c: Include strftime.h, for declaration of nstrftime.
* Use the EOVERFLOW module instead of a manual fallback for EOVERFLOW.Bruno Haible2008-03-301-4/+1
|
* Don't rely on signed integer overflowing to negative value.Lasse Collin2008-02-131-2/+3
| | | | | * lib/getugroups.c (getugroups): Include <limits.h>. Instead, compare against INT_MAX, and increment only if the test passes.
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* * lib/getugroups.c (getugroups): Detect getgrent failure.Jim Meyering2007-07-061-5/+13
| | | | Adjust comment to reflect reality: this function may return -1.
* Don't let endgrent clobber errno, no matter how improbable.Jim Meyering2007-07-051-1/+5
| | | | | * lib/getugroups.c (getugroups): Save and restore errno around endgrent call.
* Close the group DB even when failing with 2^31 or more members.Jim Meyering2007-07-051-5/+5
| | | | * lib/getugroups.c (getugroups): Don't return without calling endgrent.
* * lib/getugroups.h: New file.Jim Meyering2007-07-041-6/+7
| | | | | | | | * lib/getugroups.c: Include "getugroups.h". Remove uses of "register" keyword. Move local variable, "cp", down into scope where used. Give "username" parameter the "const" attribute. * modules/getugroups (Files): Add lib/getugroups.h
* * _fpending.c: Include <config.h> unconditionally, since we noPaul Eggert2006-09-131-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
* Correct an outdated comment. From Bruno Haible.Jim Meyering2006-05-191-2/+1
|
* Sync from coreutils.Paul Eggert2005-09-231-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .cppi-disable: Add regcomp.c, regex_internal.c, regex_internal.h, stat-time.h. * argmatch.h: Include verify.h (ARGMATCH_VERIFY): Use verify rather than rolling our own. (ARGMATCH_ASSERT): Remove; unused. * canonicalize.c: Assume STDC_HEADERS. * exclude.c: Include "strcase.h". * regex_internal.h [!defined _LIBC]: Likewise. * getusershell.c: Include stdio--.h rather than stdio.h and stdio-safer.h. (getusershell): Call fopen, not fopen_safer. * save-cwd.c: Include fcntl--.h rather than fcntl.h. Do not include unistd-safer.h. (save_cwd): Don't call fd_safer; no longer needed now that we include fcntl--.h. * modules/argmatch (Depends-on): Add verify. * modules/getloadavg (Depends-on): Depend on fcntl-safer, not unistd-safer. * modules/save-cwd (Depends-on): Likewise. * backupfile.m4, calloc.m4, chown.m4, cloexec.m4, dup2.m4: * fileblocks.m4, free.m4, ftruncate.m4, getcwd.m4, getpagesize.m4: * getugroups.m4, group-member.m4, idcache.m4, link-follow.m4: * mkstemp.m4, mktime.m4, mountlist.m4, nanosleep.m4, pathmax.m4: * physmem.m4, posixver.m4, putenv.m4, safe-read.m4, same.m4: * save-cwd.m4, stdio-safer.m4, unistd-safer.m4, unlinkdir.m4: * userspec.m4, xgetcwd.m4, xreadlink.m4: Don't bother checking for string.h, stdlib.h, unistd.h. * fts.m4 (gl_FUNC_FTS_CORE): Don't require AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK; that's now the lstat module's job. * jm-macros.m4 (gl_MACROS): Likewise. * prereq.m4 (gl_PREREQ): Add gl_FUNC_LSTAT. * backupfile.c: Use ARGMATCH_VERIFY, just in case. * posixtm.c (posixtime) [lint]: Initialize *all* of tm0, not just the .tm_year member, since otherwise gcc-4.0 would now warn about tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday. * quotearg.c (quotearg_n_options): Change code to be suboptimal, in order to avoid an unsuppressible warning from gcc on 64-bit systems. * lstat.m4 (gl_FUNC_LSTAT): Use AC_LIBSOURCES to require lstat.c and lstat.h. Remove obsolete comment. * xreadlink.m4: Use AC_LIBSOURCES and AC_LIBOBJ. * xstrtod.m4: Likewise.
* *** empty log message ***Paul Eggert2005-05-141-1/+1
|
* Merge from coreutils.Paul Eggert2004-08-071-1/+13
|
* Remove K&R cruft.Paul Eggert2003-09-091-6/+2
|
* (getugroups): Cast -1 to gid_t, for systems likeJim Meyering2000-06-041-2/+2
| | | | SunOS4.1.4 for which gid_t is an unsigned type.
* (getugroups): Don't dereference a null pointer whenJim Meyering1999-05-151-3/+10
| | | | | | | running `id USER' for some USER that is listed on the RHS in /etc/group. From Sander van Malssen. Add some curly braces, use STREQ, reverse the sense of a test and use `continue' to save a level of nesting.
* (getugroups): Take new parameter, gid.Jim Meyering1999-03-101-4/+12
| | | | | Add gid to the list of groups. From Ulrich Drepper.
* fix small thinkoJim Meyering1999-03-091-2/+1
|
* (getugroups): Take new parameter, gid.Jim Meyering1999-03-091-2/+6
| | | | | Add gid to the list of groups. From Ulrich Drepper.
* protoizeJim Meyering1998-03-131-4/+1
|
* (getugroups): Don't add a group number if it would be a duplicate.Jim Meyering1998-03-131-7/+18
| | | | From Ulrich Drepper.
* indent cpp-directivesJim Meyering1996-07-151-4/+4
|
* update FSF address in copyrightJim Meyering1996-07-151-2/+2
|
* Include stdio.h before grp.h.Jim Meyering1996-04-031-17/+6
| | | | Because <grp.h> on alpha OSF1 V2.0 uses "FILE *". From Kaveh Ghazi.
* Initial revisionJim Meyering1992-11-011-0/+86