Handle socket errors better
commitf673479c3b8a104cdd5c5561f3ae55c9dc486ecd
authorWouter Verhelst <w@uter.be>
Wed, 3 May 2017 21:46:04 +0000 (3 23:46 +0200)
committerWouter Verhelst <w@uter.be>
Wed, 3 May 2017 21:52:40 +0000 (3 23:52 +0200)
treebe793a4f1df5c97815aaedaa1ae320efaed89cc7
parente6b56c12f8a18e7a7cc253c73d1f63c2cbc41e1b
Handle socket errors better

Previously, when reading from or writing to a socket failed, we would
handle errors by simply producing an error message and exiting the
program. While that works, it does not allow for the postrun command,
specified in the configuration file, to run.

Fix this by adding a return value to readit/writeit-like functions, and
handling nonzero return values in the socket_read()/socket_write()
function, which then call a cleanup function that does the same exit
(but which will allow for doing the necessary postrun stuff).

Fixes #47 on Github
cliserv.c
cliserv.h
nbd-server.c
nbdsrv.h