diff options
Diffstat (limited to 'winsup/utils/mkgroup.c')
-rw-r--r-- | winsup/utils/mkgroup.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index b267b13ed..ea9af72f5 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -750,12 +750,22 @@ main (int argc, char **argv) "domains and machines.\n", __progname); return 1; } + domlist[print_domlist].domain = (c == 'd' || c == 'D'); opt = optarg ?: argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL; for (i = 0; i < print_domlist; ++i) - if ((!domlist[i].str && !opt) - || (domlist[i].str && opt && !strcmp (domlist[i].str, opt))) - goto skip; + if (domlist[i].domain == domlist[print_domlist].domain + && ((!domlist[i].str && !opt) + || (domlist[i].str && opt + && (off = strlen (domlist[i].str)) + && !strncmp (domlist[i].str, opt, off) + && (!opt[off] || opt[off] == ',')))) + { + fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n", + __progname, domlist[i].domain ? "domain" : "machine", + domlist[i].str); + goto skip; + } if (!(domlist[print_domlist].str = opt)) print_system = 1; domlist[print_domlist].id_offset = ULONG_MAX; @@ -772,9 +782,8 @@ main (int argc, char **argv) } *p = '\0'; } - domlist[print_domlist].domain = (c == 'd' || c == 'D'); domlist[print_domlist++].with_dom = (c == 'D' || c == 'L'); - skip: +skip: break; case 'S': sep_char = optarg; |