Date: Sat, 15 Mar 2008 01:10:02 GMT From: bruce@cran.org.uk To: freebsd-bugs@FreeBSD.org Subject: Re: bin/112303: route(8): 'route get' returns wrong exit code if no match Message-ID: <200803150110.m2F1A20X074538@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/112303; it has been noted by GNATS. From: bruce@cran.org.uk To: bug-followup@freebsd.org Cc: cpetrie@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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803150110.m2F1A20X074538>