Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jun 2018 05:10:30 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335405 - stable/11/usr.sbin/sysrc
Message-ID:  <201806200510.w5K5AURT073751@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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
 		;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806200510.w5K5AURT073751>