svn commit: r335405 - stable/11/usr.sbin/sysrc
Devin Teske
dteske at FreeBSD.org
Wed Jun 20 05:10:31 UTC 2018
Author: dteske
Date: Wed Jun 20 05:10:30 2018
New Revision: 335405
URL: https://svnweb.freebsd.org/changeset/base/335405
Log:
MFC r335277:
sysrc(8): Exit with failure on API error
Fix exit status when f_sysrc_set() fails. Errors in the underlying API
provided by bsdconfig(8) -- /usr/share/bsdconfig/sysrc.subr -- were not
being communicated back to the command-line. This was affecting ansible
modules using sysrc as they were not able to accurately test for error.
PR: bin/211448
Reported by: Christian Schwarz <me at cschwarz.com>
Sponsored by: Smule, Inc.
Modified:
stable/11/usr.sbin/sysrc/sysrc
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.sbin/sysrc/sysrc
==============================================================================
--- stable/11/usr.sbin/sysrc/sysrc Wed Jun 20 03:31:19 2018 (r335404)
+++ stable/11/usr.sbin/sysrc/sysrc Wed Jun 20 05:10:30 2018 (r335405)
@@ -1,6 +1,6 @@
#!/bin/sh
#-
-# Copyright (c) 2010-2016 Devin Teske
+# Copyright (c) 2010-2018 Devin Teske
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
#
# Version information
#
-SYSRC_VERSION="7.1 Feb-2,2016"
+SYSRC_VERSION="7.2 Jun-16,2018"
#
# Options
@@ -842,7 +842,7 @@ while [ $# -gt 0 ]; do
#
if [ ! "$SHOW_VALUE" ]; then
echo "$NAME"
- f_sysrc_set "$NAME" "$new"
+ f_sysrc_set "$NAME" "$new" || status=$FAILURE
else
if f_sysrc_set "$NAME" "$new"; then
if [ "$SHOW_FILE" ]; then
@@ -854,6 +854,8 @@ while [ $# -gt 0 ]; do
echo -n "$before${SHOW_EQUALS:+\" #}"
echo -n " -> ${SHOW_EQUALS:+\"}$after"
echo "${SHOW_EQUALS:+\"}"
+ else
+ status=$FAILURE
fi
fi
;;
More information about the svn-src-stable
mailing list