bin/112303: route(8): 'route get' returns wrong exit code if no
match
bruce at cran.org.uk
bruce at cran.org.uk
Sat Mar 15 01:10:03 UTC 2008
The following reply was made to PR bin/112303; it has been noted by GNATS.
From: bruce at cran.org.uk
To: bug-followup at freebsd.org
Cc: cpetrie at xcalibre.co.uk
Subject: Re: bin/112303: route(8): 'route get' returns wrong exit code if no match
Date: Sat, 15 Mar 2008 01:02:14 +0000
--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In route.c in newroute() there's a call to exit(0) if the command was
'get'. Since rtmsg() always gets called and returns 0 on success and -1
on failure, it's possible to exit with a suitable exit code by calling
exit(ret != 0) instead, as is done at the end of newroute().
--
Bruce
--fUYQa+Pmc3FrFX/N
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="route.c.diff"
--- route_old.c 2008-03-15 00:42:34.000000000 +0000
+++ route.c 2008-03-15 00:40:41.000000000 +0000
@@ -748,7 +748,7 @@
break;
}
if (*cmd == 'g')
- exit(0);
+ exit(ret != 0);
if (!qflag) {
oerrno = errno;
(void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
--fUYQa+Pmc3FrFX/N--
More information about the freebsd-bugs
mailing list