Fix pg_recvlogical not to fsync output when it's a tty or pipe.
Fix pg_recvlogical not to fsync output when it's a tty or pipe.

The previous coding tried to handle possible failures when fsyncing a
tty or pipe fd by accepting EINVAL - but apparently some
platforms (windows, OSX) don't reliably return that. So instead check
whether the output fd refers to a pipe or a tty when opening it.

Reported-By: Olivier Gosseaume, Marko Tiikkaja
Discussion: 559AF98B.3050901@joh.to

Backpatch to 9.4, where pg_recvlogical was added.

jmcatamney/gpdb,lisakowen/gpdb,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,xinzweb/gpdb,50wu/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,lisakowen/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,50wu/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,greenplum-db/gpdb,50wu/gpdb,ashwinstar/gpdb,adam8157/gpdb,ashwinstar/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,lisakowen/gpdb,jmcatamney/gpdb,xinzweb/gpdb,ashwinstar/gpdb,lisakowen/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,50wu/gpdb,xinzweb/gpdb,adam8157/gpdb,xinzweb/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,lisakowen/gpdb,50wu/gpdb,xinzweb/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,50wu/gpdb,ashwinstar/gpdb,ashwinstar/gpdb