diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-05 19:30:48 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-05 19:30:48 +0000 |
commit | 46e6d8bcba28417d1056200d9018ad7dfec65665 (patch) | |
tree | 43837bd56d33fb8a9eb3ac7b8a90b62ac4b7c18d /lib/libssl/bio_ssl.c | |
parent | 0a7e0d8541264c4905bb3bd9a37bba0627d9da1c (diff) |
Get rid of useless/confusing subshell
This function's style is a bit off: it wraps the body in a subshell to
discard all stdout/err at once, but still uses return inside it.
1. A command list (using {}) would be enough here as it groups like a
subshell but avoids spawning another shell;
2. discarding stdout/err at the end of an if block works the same
(effecting both condition and body) and saves one level of indent;
3. return inside a subshell inside a function does NOT return from the
function but merely exits the subshell; this is easily misread.
Saving a fork and indent and improving readability boils down to this
(cvs diff -wU1):
|@@ -3320,3 +3317,2 @@ check_unattendedupgrade() {
| _d=${_d%% *}
|- (
| if [[ -n $_d ]]; then
|@@ -3331,5 +3327,5 @@ check_unattendedupgrade() {
| rm -f /dev/{r,}$_d?
|- fi
|+ fi >/dev/null 2>&1
|+
| return $_rc
|- ) > /dev/null 2>&1
| }
OK halex
Diffstat (limited to 'lib/libssl/bio_ssl.c')
0 files changed, 0 insertions, 0 deletions