Bug 203062

Summary: ifconfig always has exit status 0
Product: Base System Reporter: Kristof Provost <kp>
Component: binAssignee: Allan Jude <allanjude>
Status: Closed FIXED    
Severity: Affects Many People CC: hrs
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Kristof Provost freebsd_committer freebsd_triage 2015-09-12 19:22:14 UTC
ifconfig doesn't return errors if the ioctl() fails.
It prints the error, but always does exit(0).
This makes it annoying to use in scripts.

For example, when trying to rename an interface to conflict with an existing interface:
% sudo ifconfig lo0 name vtnet0 ; echo $?
ifconfig: ioctl (set name): File exists
0
Comment 1 Kristof Provost freebsd_committer freebsd_triage 2015-09-14 00:14:05 UTC
Allan posted a patch in https://reviews.freebsd.org/D3644
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-09-16 03:03:49 UTC
A commit references this bug:

Author: allanjude
Date: Wed Sep 16 03:03:20 UTC 2015
New revision: 287842
URL: https://svnweb.freebsd.org/changeset/base/287842

Log:
  Make ifconfig always exit with an error code if an important ioctl fails

  PR:		203062
  Arm Twisting by:	Kristof Provost
  Reviewed by:	kp
  Approved by:	bapt (mentor)
  MFC after:	2 weeks
  Relnotes:	yes
  Sponsored by:	ScaleEngine Inc.
  Sponsored by:	vBSDCon
  Differential Revision:	https://reviews.freebsd.org/D3644

Changes:
  head/sbin/ifconfig/ifconfig.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-01-12 05:57:48 UTC
A commit references this bug:

Author: allanjude
Date: Tue Jan 12 05:56:49 UTC 2016
New revision: 293729
URL: https://svnweb.freebsd.org/changeset/base/293729

Log:
  MFC: r287842
    Make ifconfig always exit with an error code if an important ioctl fails

  PR:		203062

Changes:
_U  stable/10/
  stable/10/sbin/ifconfig/ifconfig.c