Bug 186333 - route(8) fails to return correct exit status in quiet mode
Summary: route(8) fails to return correct exit status in quiet mode
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-01 08:30 UTC by Eugene Grosbein
Modified: 2018-11-26 11:10 UTC (History)
1 user (show)

See Also:
eugen: mfc-stable12+
eugen: mfc-stable11+


Attachments
file.diff (468 bytes, patch)
2014-02-01 08:30 UTC, Eugene Grosbein
no flags Details | Diff
fix exit status for "route -q add/change/delete" (645 bytes, patch)
2017-05-19 09:26 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2014-02-01 08:30:00 UTC
	Exit status of route(8) command in case of failure
	depends of presence of '-q' flags: exit status is always 0 with '-q'.

How-To-Repeat: 
# route delete default
delete net default fib 0
# route -q change default 10.58.0.1; echo $?
route: writing to routing socket: No such process
0
# route change default 10.58.0.1; echo $?
route: writing to routing socket: No such process
change net default: gateway 10.58.0.1 fib 0: not in table
1
Comment 1 Hiroki Sato freebsd_committer 2014-02-01 08:31:21 UTC
Responsible Changed
From-To: freebsd-bugs->hrs

I'll take this.
Comment 2 Eugene Grosbein freebsd_committer 2017-05-19 09:26:29 UTC
Created attachment 182735 [details]
fix exit status for "route -q add/change/delete"

New fix for same problem.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:40:37 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 4 Eugene Grosbein freebsd_committer 2018-10-07 10:46:50 UTC
My PR.
Comment 5 commit-hook freebsd_committer 2018-10-27 08:00:11 UTC
A commit references this bug:

Author: eugen
Date: Sat Oct 27 07:59:19 UTC 2018
New revision: 339811
URL: https://svnweb.freebsd.org/changeset/base/339811

Log:
  route(8): correctly return exit status when "-q" flag is used.

  Previously, route returned 1 in case of error  properly signalling failure
  but "route -q" it returned 0 for same case. Fix it.

  PR:		186333
  MFC after:	1 month

Changes:
  head/sbin/route/route.c
Comment 6 commit-hook freebsd_committer 2018-11-26 11:05:46 UTC
A commit references this bug:

Author: eugen
Date: Mon Nov 26 11:05:27 UTC 2018
New revision: 340940
URL: https://svnweb.freebsd.org/changeset/base/340940

Log:
  MFC r339811: route(8): correctly return exit status when "-q" flag
  is used.

    Previously, route returned 1 in case of error  properly signalling
    failure but "route -q" it returned 0 for same case. Fix it.

  PR:		186333

Changes:
_U  stable/12/
  stable/12/sbin/route/route.c
Comment 7 commit-hook freebsd_committer 2018-11-26 11:08:50 UTC
A commit references this bug:

Author: eugen
Date: Mon Nov 26 11:08:38 UTC 2018
New revision: 340943
URL: https://svnweb.freebsd.org/changeset/base/340943

Log:
  MFC r339811: route(8): correctly return exit status when "-q" flag
  is used.

    Previously, route returned 1 in case of error properly signalling
    failure but "route -q" returned 0 in the same case. Fix it.

  PR:		186333

Changes:
_U  stable/11/
  stable/11/sbin/route/route.c