Initialize pidfilename with NULL

The bug has been found by Coverity scan (CWE-457).
Terminate buffer with NULL

The bug has been found by Coverity scan. (CWE-170)
Check if sent() returned correctly, otherwise print errno message
Merge pull request #18 from Barthalion/coverity

Coverity fixes