Refactored string copying in riemann plugin

Extracted repeated strlen-malloc-sstrncpy chain to own function to
cleanup code a bit.
Improved error handling in riemann socket handling

In close_socket() handle EBADF correctly and release sock_addr if such
exists.

In send_msg() try to reconnect/resend once if suitable errno is returned
from initial sendto() call.
Improved error / warning messages in riemann plugin