Hi Philip,
Philip Guenther wrote on Sat, Oct 18, 2014 at 04:38:09PM -0700:
> Maybe we just fix getent(1) to return an error like it does for ethers?
Whatever we do with gethostent(3) - maybe it's really expendable,
maybe tons of ports depend on it, who knows - i'm fine with
removing hosts enumeration support from getent(1).
Almost the same can be accomplished with
cat /etc/hosts
and with more clarity as to what it does and what the shortcomings are.
That would be the following patch:
Yours,
Ingo
Index: getent.c
===================================================================
RCS file: /cvs/src/usr.bin/getent/getent.c,v
retrieving revision 1.6
diff -u -p -r1.6 getent.c
--- getent.c 30 Mar 2013 14:03:08 -0000 1.6
+++ getent.c 19 Oct 2014 00:23:47 -0000
@@ -270,8 +270,9 @@ hosts(int argc, char *argv[])
sethostent(1);
if (argc == 2) {
- while ((he = gethostent()) != NULL)
- hostsprint(he);
+ fprintf(stderr, "%s: Enumeration not supported on hosts\n",
+ __progname);
+ rv = RV_NOENUM;
} else {
for (i = 2; i < argc; i++) {
he = NULL;