Re: sh(1) exec redirection

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
    Date:        Tue, 5 Nov 2024 17:55:38 +0100
    From:        Edgar =?iso-8859-1?B?RnXf?= <[email protected]>
    Message-ID:  <[email protected]>

  | After digging for hours why something like
  | 	FOO_PASS_FD=3 exec /usr/pkg/bin/foo 3</path/to/pass
  | worked on -6, but not on -8, I found out that redir.c:1.38 introduced 
  | setting close-on-exec for redirections, 1.40 tried to fix it, but probably 
  | not for the command being exec'ed being exec.
  | At least 1.55 made it conditional on !posix, so I have a workaround.

I will look at it, see if there's some simple solution, but there
is (or should be) another workaround

	3<&3

should turn off close on exec, so

	FOO_PASS_FD=3 exec something 3</whatever 3<&3

should work.

kre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.