Fix pg_file_write() error handling.
Fix pg_file_write() error handling.

Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull",
"pg_file_write('devfull', 'x', true)" now fails as it should.  Don't
leak a stream when fwrite() fails.  Remove a born-ineffective test that
aimed to skip zero-length writes.  Back-patch to 9.2 (all supported
versions).

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