diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-28 21:24:26 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-28 21:24:26 +0200 |
commit | 4341f63af3b49a3f213c8cbd6d88985ea7312957 (patch) | |
tree | af8c46174fcb79400f90950297b61aab25341262 /main.c | |
parent | a2353048716e96cc0b3d5c69bc6159902602abe9 (diff) | |
download | egawk-4341f63af3b49a3f213c8cbd6d88985ea7312957.tar.gz egawk-4341f63af3b49a3f213c8cbd6d88985ea7312957.tar.bz2 egawk-4341f63af3b49a3f213c8cbd6d88985ea7312957.zip |
Make getgroups error non-fatal. Minor doc update.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1372,17 +1372,20 @@ init_groupset() */ ngroups = getgroups(0, NULL); #endif - if (ngroups == -1) - fatal(_("could not find groups: %s"), strerror(errno)); - else if (ngroups == 0) + /* If an error or no groups, just give up and get on with life. */ + if (ngroups <= 0) return; /* fill in groups */ emalloc(groupset, GETGROUPS_T *, ngroups * sizeof(GETGROUPS_T), "init_groupset"); ngroups = getgroups(ngroups, groupset); - if (ngroups == -1) - fatal(_("could not find groups: %s"), strerror(errno)); + /* same thing here, give up but keep going */ + if (ngroups == -1) { + efree(groupset); + ngroups = 0; + groupset = NULL; + } #endif } |