common: Fix gnupg_reopen_std.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 2 Oct 2018 05:22:24 +0000 (14:22 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 2 Oct 2018 05:22:24 +0000 (14:22 +0900)
commit50b02dba2060a8969da47b18d9c0ecdccbd30db4
tree3baa8916fd8bd8debbc4d934da145f193eb92307
parent0cb65564e022fface5ada4de8e0c2c4c3d0ac8ad
common: Fix gnupg_reopen_std.

* common/sysutils.c (gnupg_reopen_std): Use fcntl instead of fstat.

--

When gpg was invoked by a Perl web application on FreeBSD, fstat in
gnupg_reopen_std failed with EBADF.  Using fcntl, which is considered
lighter than fstat, it works fine.  Since uur purpose is to check if
file descriptor is valid or not, lighter operation is better.

Reported-by: Marcin Gryszkalis <mg@fork.pl>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
common/sysutils.c