tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sh(1) exec redirection



    Date:        Tue, 5 Nov 2024 17:55:38 +0100
    From:        Edgar =?iso-8859-1?B?RnXf?= <ef%math.uni-bonn.de@localhost>
    Message-ID:  <ZypOCnQfvxWmt4bq%trav.math.uni-bonn.de@localhost>

  | 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


Home | Main Index | Thread Index | Old Index