Skip to contentSkip to conversation

Close original fd after bash-generated high redirection.

PATCH In review John Reiser 1 participant 1 message Aug 31, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 8/8 Close original fd after bash-generated high redirection.

---
 dracut           |    3 ++-
 dracut-functions |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
dracut +2 -1
index d42f258..c46244f 100755
@@ -616,7 +616,8 @@ if [[ $kernel_only != yes ]]; then
 fi
  # bash sets cpio_stdin to a new fd >= 10.  See REDIRECTION in bash manpage.
-)  {cpio_stdin}>&1  |  cpio -pdmu "${initdir}"
+# Pipe that new fd as stdin into cpio, and ignore the old stdout of subshell.
+)  {cpio_stdin}>&1  1>&-  |  cpio -pdmu --quiet "${initdir}"
  if (($maxloglvl >= 5)); then
     ddebug "Listing sizes of included files:"
dracut-functions +1 -1
index 8109699..1942bf9 100755
@@ -959,7 +959,7 @@ instmods() {
     # Capture all stderr from modprobe onto a new fd $modprobe_stderr,
     # and pipe it into egrep.  See REDIRECTION in bash manpage.
     export modprobe_stderr
-    ( instmods_1 "$@" ) {modprobe_stderr}>&1 \
+    ( instmods_1 "$@" ) {modprobe_stderr}>&1  1>&- \
     | egrep -v 'FATAL: Module .* not found.' | derror
     return $?
 }
Signature · 4 lines
1.7.6


--