util-linux: add a check for mkostemp()
mkostemp() is missing with older version of uClibc (uClibc <= 0.9.33).
So, we need to check if mkostemp() is available.
If not, we use a wrapper function based on mkstemp() to implement it.
Since util-linux v2.23, mkostemp() is called with O_CLOEXEC flag.
If we use a define to mkstemp() to implement mkostemp(), flags will be
discared.
mkstemp() will pass O_RDWR|O_CREAT|O_EXCL, but not O_CLOEXEC, which
means that the file descriptor will no longer be closed automatically
upon exec().
To avoid to discard the flags, we add a call to fcntl() to set O_CLOEXEC
flag just after mkstemp().
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>