Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2022 15:25:07 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 45eb93a964e6 - stable/13 - bsdinstall: stop messing with file descriptors
Message-ID:  <202205161525.24GFP7vI006793@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=45eb93a964e669dabb1d7f59dadac23c4238f878

commit 45eb93a964e669dabb1d7f59dadac23c4238f878
Author:     Corvin Köhne <CorvinK@beckhoff.com>
AuthorDate: 2022-05-03 14:00:09 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-05-16 15:24:56 +0000

    bsdinstall: stop messing with file descriptors
    
    Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
    $TERMINAL_STDOUT_PASSTHRU). By closing file descriptor 3 here, the
    final f_dprintf "Installation Completed ... does not work anymore.
    
    By putting the code into a subshell, file descriptors can be edited
    without interference with the calling script.
    
    Reviewed by:            emaste
    Differential Revision:  https://reviews.freebsd.org/D35113
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    MFC after:              3 days
    
    (cherry picked from commit 1f7746d81f53447ac15cc99395bb714d4dd0a4da)
---
 usr.sbin/bsdinstall/scripts/script | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script
index 8d9dd5205132..92332241f348 100755
--- a/usr.sbin/bsdinstall/scripts/script
+++ b/usr.sbin/bsdinstall/scripts/script
@@ -115,12 +115,13 @@ fi
 bsdinstall mount
 
 # Fetch missing distribution files, if any
-exec 3>&1
-export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3)
-FETCH_RESULT=$?
-exec 3>&-
-
-[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
+(
+	exec 3>&1
+	export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3)
+	FETCH_RESULT=$?
+	exec 3>&-
+	return $FETCH_RESULT
+) || error "Could not fetch remote distributions"
 
 # Unpack distributions
 bsdinstall checksum



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