Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-08-11 12:59:50 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-08-11 12:59:50 +0400
commit91dd009e81c3f1934a65f46b39b5a653c8be7fa4 (patch)
treeb7b8fa60b33b5a700bec7c8329573e134305990c /winsup/utils/mkgroup.c
parentb1ce1770ea256a9a2e88c4d0be902322899fe42d (diff)
* mkgroup.c (enum_local_groups): Avoid error message if given group
name isn't found and return 0 to allow searching to proceed. Always return 0 or 1, not -1. (enum_groups): Avoid error message if given group name isn't found. * mkpasswd.c (enum_users): Ditto.
Diffstat (limited to 'winsup/utils/mkgroup.c')
-rw-r--r--winsup/utils/mkgroup.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
index 07d15fe5f..fe55651e2 100644
--- a/winsup/utils/mkgroup.c
+++ b/winsup/utils/mkgroup.c
@@ -346,12 +346,17 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
{
DWORD i;
- if (disp_groupname != NULL)
+ if (disp_groupname)
{
mbstowcs (gname, disp_groupname, GNLEN + 1);
rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
if (rc == ERROR_SUCCESS)
entriesread = 1;
+ /* Allow further searching for the group and avoid annoying
+ error messages just because the group is not a local group or
+ the group hasn't been found. */
+ else if (rc == ERROR_NO_SUCH_ALIAS || rc == NERR_GroupNotFound)
+ return 0;
}
else
rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,
@@ -453,10 +458,10 @@ skip_group:
}
while (rc == ERROR_MORE_DATA);
- /* Return -1 if the single group we're looking for has been found here to
+ /* Return 1 if the single group we're looking for has been found here to
avoid calling enum_groups for the same group, thus avoiding a spurious
error message "group name could not be found" in enum_groups. */
- return disp_groupname && entriesread ? -1 : 0;
+ return disp_groupname && entriesread ? 1 : 0;
}
static void
@@ -502,6 +507,10 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2,
(void *) &buffer);
entriesread=1;
+ /* Avoid annoying error messages just because the group hasn't been
+ found. */
+ if (rc == NERR_GroupNotFound)
+ return;
}
else
rc = NetGroupEnum (servername, 2, (void *) & buffer,