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
Allan posted a patch in https://reviews.freebsd.org/D3644
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
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