diff options
author | dteske <dteske@FreeBSD.org> | 2012-09-21 01:36:20 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2012-09-21 01:36:20 +0000 |
commit | 36137540d6046459e5a8f5403fe04c12101b75df (patch) | |
tree | 64908c3644f93810ed9501a5e081ad2a98852d45 /usr.sbin/bsdconfig/share | |
parent | f628c47944e7370c8d8c16cdcc6f98871a48be02 (diff) | |
download | FreeBSD-src-36137540d6046459e5a8f5403fe04c12101b75df.zip FreeBSD-src-36137540d6046459e5a8f5403fe04c12101b75df.tar.gz |
Replace redirections to /dev/null with "close file-descriptor" syntax (>&-).
Reviewed by: adrian (co-mentor)
Approved by: adrian (co-mentor)
Diffstat (limited to 'usr.sbin/bsdconfig/share')
-rw-r--r-- | usr.sbin/bsdconfig/share/common.subr | 2 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/dialog.subr | 6 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/mustberoot.subr | 12 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/strings.subr | 2 | ||||
-rw-r--r-- | usr.sbin/bsdconfig/share/sysrc.subr | 22 |
5 files changed, 22 insertions, 22 deletions
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index c724c62..49d3023 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -72,7 +72,7 @@ f_err() # f_quietly() { - "$@" > /dev/null 2>&1 + "$@" >&- 2>&- } # f_have $anything ... diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index d2ba529..4f86e7b 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -1321,7 +1321,7 @@ f_dialog_init() # Process stored command-line arguments # SECURE=$( set -- "$ARGV" - while getopts S flag > /dev/null; do + while getopts S flag >&-; do case "$flag" in S) echo 1;; \?) continue;; @@ -1329,7 +1329,7 @@ f_dialog_init() done ) USE_XDIALOG=$( set -- "$ARGV" - while getopts SX flag > /dev/null; do + while getopts SX flag >&-; do case "$flag" in S|X) echo 1;; \?) continue;; @@ -1372,7 +1372,7 @@ f_dialog_init() eval xauth -if \~$SUDO_USER/.Xauthority extract - \ \"\$HOSTNAME/unix:\$displaynum\" \ \"\$HOSTNAME:\$displaynum\" | sudo sh -c 'xauth -ivf \ - ~root/.Xauthority merge - > /dev/null 2>&1' + ~root/.Xauthority merge - >&- 2>&-' fi # diff --git a/usr.sbin/bsdconfig/share/mustberoot.subr b/usr.sbin/bsdconfig/share/mustberoot.subr index c6514c0..234724e 100644 --- a/usr.sbin/bsdconfig/share/mustberoot.subr +++ b/usr.sbin/bsdconfig/share/mustberoot.subr @@ -85,7 +85,7 @@ f_become_root_via_sudo() # # Check sudo(8) access before prompting for password. # - :| sudo -S -v 2> /dev/null + :| sudo -S -v 2>&- if [ $? -ne $SUCCESS ]; then # # sudo(8) access denied. Prompt for their password. @@ -112,7 +112,7 @@ f_become_root_via_sudo() --ok-label "$msg_ok" \ --cancel-label "$msg_cancel" \ --password --inputbox "$msg" $size \ - 2>&1 > /dev/null ) + 2>&1 >&- ) retval=$? # Catch X11-related errors @@ -141,7 +141,7 @@ f_become_root_via_sudo() # # Validate sudo(8) credentials # - sudo -S -v 2> /dev/null <<-EOF + sudo -S -v 2>&- <<-EOF $password EOF retval=$? @@ -186,7 +186,7 @@ f_become_root_via_sudo() displaynum="${DISPLAY#*:}" xauth -f ~/.Xauthority extract - $HOSTNAME/unix:$displaynum \ $HOSTNAME:$displaynum | sudo sh -c 'xauth -ivf \ - ~root/.Xauthority merge - > /dev/null 2>&1' + ~root/.Xauthority merge - >&- 2>&-' fi # Re-execute ourselves with sudo(8) @@ -254,7 +254,7 @@ f_authenticate_some_user() $height $width \ "$field_username" "" \ "$field_password" "" \ - 2>&1 > /dev/null ) + 2>&1 >&- ) retval=$? # Catch X11-related errors @@ -302,7 +302,7 @@ f_authenticate_some_user() su -m "$user" <<-EOF sh <<EOS sudo -k - sudo -S -v 2> /dev/null <<EOP + sudo -S -v 2>&- <<EOP $password EOP EOS diff --git a/usr.sbin/bsdconfig/share/strings.subr b/usr.sbin/bsdconfig/share/strings.subr index 1a330ad..fac55fe 100644 --- a/usr.sbin/bsdconfig/share/strings.subr +++ b/usr.sbin/bsdconfig/share/strings.subr @@ -98,7 +98,7 @@ f_isinteger() # Attempt to perform arithmetic divison (an operation which will exit # with error unless arg is a valid positive/negative whole integer). # - ( : $((0/$arg)) ) > /dev/null 2>&1 + ( : $((0/$arg)) ) >&- 2>&- } fi # ! $_STRINGS_SUBR diff --git a/usr.sbin/bsdconfig/share/sysrc.subr b/usr.sbin/bsdconfig/share/sysrc.subr index 014ab46..e39b67a 100644 --- a/usr.sbin/bsdconfig/share/sysrc.subr +++ b/usr.sbin/bsdconfig/share/sysrc.subr @@ -134,7 +134,7 @@ f_sysrc_get() # f_clean_env --except RC_CONFS RC_DEFAULTS SUCCESS - . "$RC_DEFAULTS" > /dev/null 2>&1 + . "$RC_DEFAULTS" >&- 2>&- unset RC_DEFAULTS # no longer needed @@ -153,7 +153,7 @@ f_sysrc_get() # If RC_CONFS is defined, set $rc_conf_files to an explicit # value, modifying the default behavior of source_rc_confs(). # - ( : ${RC_CONFS?} ) > /dev/null 2>&1 + ( : ${RC_CONFS?} ) >&- 2>&- if [ $? -eq ${SUCCESS:-0} ]; then rc_conf_files="$RC_CONFS" _rc_confs_set=1 @@ -162,7 +162,7 @@ f_sysrc_get() unset SUCCESS # no longer needed - source_rc_confs > /dev/null 2>&1 + source_rc_confs >&- 2>&- # # If the query was for `rc_conf_files' AND after calling @@ -190,7 +190,7 @@ f_sysrc_get() # such as "${varname?}" and "${varname:?}" (see "Parameter # Expansion" in sh(1) for more information). # - eval echo '"${'"$1"'}"' 2> /dev/null + eval echo '"${'"$1"'}"' 2>&- ) } @@ -221,7 +221,7 @@ f_sysrc_get_default() # f_clean_env --except RC_DEFAULTS - . "$RC_DEFAULTS" > /dev/null 2>&1 + . "$RC_DEFAULTS" >&- 2>&- unset RC_DEFAULTS # no longer needed @@ -232,7 +232,7 @@ f_sysrc_get_default() # such as "${varname?}" and "${varname:?}" (see "Parameter # Expansion" in sh(1) for more information). # - eval echo '"${'"$1"'}"' 2> /dev/null + eval echo '"${'"$1"'}"' 2>&- ) } @@ -477,7 +477,7 @@ f_sysrc_set() # permissions from the temporary file). # local mode - mode=$( stat -f '%#Lp' "$file" 2> /dev/null ) + mode=$( stat -f '%#Lp' "$file" 2>&- ) f_quietly chmod "${mode:-0644}" "$tmpfile" # @@ -486,14 +486,14 @@ f_sysrc_set() # permissions (so we throw stderr into the bit-bucket). # local owner - owner=$( stat -f '%u:%g' "$file" 2> /dev/null ) + owner=$( stat -f '%u:%g' "$file" 2>&- ) f_quietly chown "${owner:-root:wheel}" "$tmpfile" # # Operate on the matching file, replacing only the last occurrence. # local new_contents retval - new_contents=$( tail -r $file 2> /dev/null ) + new_contents=$( tail -r $file 2>&- ) new_contents=$( echo "$new_contents" | awk -v varname="$varname" \ -v new_value="$new_value" "$f_sysrc_set_awk" ) retval=$? @@ -572,8 +572,8 @@ f_sysrc_delete() # permissions) to instead match the destination file. # local mode owner - mode=$( stat -f '%#Lp' "$file" 2> /dev/null ) - owner=$( stat -f '%u:%g' "$file" 2> /dev/null ) + mode=$( stat -f '%#Lp' "$file" 2>&- ) + owner=$( stat -f '%u:%g' "$file" 2>&- ) f_quietly chmod "${mode:-0644}" "$tmpfile" f_quietly chown "${owner:-root:wheel}" "$tmpfile" |