mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-06 18:29:47 +00:00
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> MFC after: 3 days X-MFC-to: stable/11 Sponsored by: Smule, Inc.
This commit is contained in:
parent
6fee3bb8e1
commit
5c165dcf50
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335277
@ -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
|
||||
@ -854,7 +854,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
|
||||
@ -866,6 +866,8 @@ while [ $# -gt 0 ]; do
|
||||
echo -n "$before${SHOW_EQUALS:+\" #}"
|
||||
echo -n " -> ${SHOW_EQUALS:+\"}$after"
|
||||
echo "${SHOW_EQUALS:+\"}"
|
||||
else
|
||||
status=$FAILURE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user