Compare write result correctly with 0

Fixes client sending of orders
This commit is contained in:
Marc Di Luzio 2015-01-07 12:39:27 +00:00
parent 1c97177956
commit 3291bf126e

View file

@ -233,7 +233,7 @@ std::string WaitForGamestateMessage(int sockfd)
int SendOrdersToServer(int sockfd, const std::string &orders) int SendOrdersToServer(int sockfd, const std::string &orders)
{ {
int n = write(sockfd,orders.c_str(),orders.length()); int n = write(sockfd,orders.c_str(),orders.length());
if (0 < n) if (n < 0)
fatal_perror("ERROR writing to socket"); fatal_perror("ERROR writing to socket");
return n; return n;
} }