Use errno to test Broken pipe

The value could depend on the OS

review10691002