chiark / gitweb /
util: in make_stdio() use dup2() rather than dup3()
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Dec 2014 20:54:00 +0000 (21:54 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Dec 2014 00:36:28 +0000 (01:36 +0100)
commit20b63d12b533daf2e9b2936ffb03074861e1673e
tree8c21608e7d9e5a767da287b7fd04d7c432e1e0e4
parent82e6c50c473f4be8df77c7a510577f1975eedddb
util: in make_stdio() use dup2() rather than dup3()

dup3() allows setting O_CLOEXEC which we are not interested in. However,
it also fails if called with the same fd as input and output, which is
something we don't want. Hence use dup2().

Also, we need to explicitly turn off O_CLOEXEC for the fds, in case the
input fd was O_CLOEXEC and < 3.
src/shared/util.c