Fix typo in include guard test

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
Remove return statements after calls to err()

err() does not return, but exits with error code

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: fix server socket initialization

Change the value for undefined descriptor from 0 to -1 because any value
greater or equal to 0 can be a valid file descriptor.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: remove unused function serve_err()

Error reporting and handling should be streamlined. Currently there are
quite many different ways errors are being logged, reported and handled.

This shall be the first baby step towards more uniform error management.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: replace msg2(), msg3() and msg4() with variadic msg()

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
Use a C99-style variadic macro rather than a variadic function

Since that function effectively only really calls one other function,
that should be somewhat more efficient.
nbd-server: remove unused CFILE_PROGERR error code

Programmer errors should not be mixed with runtime errors. If there's a
prorammer error, then there's nothing we can do about it during runtime,
and the program should fail as early and loud as possible.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: fix dosockopts() to report errors

The purpose of this change is to separate error reporting from error
handling and hence make dosockopts() usable also in other calling
contexts. dosockopts() reports errors in setting socket options and then
it's up to the caller to decide how to react to those errors.

This is a step towards more uniform and robust error management. Similar
changes needs to be done to other functions as well.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: fix dup_serve() to accept a const server pointer

dup_serve() does not modify the source server (as it should be), so the
pointer should be declared const.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>
nbd-server: fix append_serve() to accept a const server pointer

Now that dup_server() accepts const pointer, append_serve() can also
accept const pointer. There should not be any need to modify the server
when appending it to the array.

Signed-off-by: Tuomas Jorma Juhani Räsänen <tuomasjjrasanen@tjjr.fi>