MFV r299233: Apply upstream fix 11edb37a71851b5bcbd4e51ca6ad3dcbf57e9761:

Revert: Don't close stdin...

This have been observed by portupgrade in its interaction with file(1),
as reported as a regression in bin/209211.

PR:		209211
MFC after:	3 days
This commit is contained in:
Xin LI 2016-05-08 09:30:36 +00:00
commit 7206c4fc60

View File

@ -346,7 +346,7 @@ private void
close_and_restore(const struct magic_set *ms, const char *name, int fd,
const struct stat *sb)
{
if (name == NULL)
if (fd == STDIN_FILENO || name == NULL)
return;
(void) close(fd);