collectdctl command hangs on AIX and returns error 0 on Solaris.

Summary:
Problem: collectdctl command hangs on AIX and returns error 0 on Solaris.

Root cause - client (collectdctl) and server (collectd daemon) are using fprintf to communicate using Unix domain socket, Since fprintf buffers, command sent by client did not reach server, since client does not get the response, it closes the socket which forces the client to flush the command, now server receives the command, when responding, it gets socket error because the client already closed the socket.

Solution: Added flush after all fprintf calls.

Test Plan: Tested collectdctl on AIX and SunOS for listval, getval commands

Reviewers: skhajamo

Reviewed By: skhajamo

CC: arcyd

Differential Revision: https://all.phab.dev.bloomberg.com/D155584
Wrap the content of macro with do/while to make it safer as per code review comment
Removed extra semicolon
Merge pull request #827 from yogeswaran/collectdctl

collectdctl command hangs on AIX and returns error 0 on Solaris.