author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 31 Jul 2017 05:21:24 +0000 (12:21 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Tue, 26 Sep 2017 20:05:33 +0000 (03:05 +0700) | ||
commit | 243163d9a20ed9961f6c2eefe59b411b5c39d707 | |
tree | 891a4f54d3f9ab2272098e2d51dd84c766d47161 | tree | snapshot |
parent | 686bd66e6b1624c07f8c469b41e902d5bfc33131 | commit | diff |
Proper return value from 'swrite()' when connection has been closed
According to POSIX, errno is set only if 'recv()' returns -1.
When connection has been closed, 'recv()' returns 0 and errno left untouched.
For functions which check errno value after 'swrite()', errno now is set to ECONNRESET,
so they produce correct message 'Connection reset by peer'.
According to POSIX, errno is set only if 'recv()' returns -1.
When connection has been closed, 'recv()' returns 0 and errno left untouched.
For functions which check errno value after 'swrite()', errno now is set to ECONNRESET,
so they produce correct message 'Connection reset by peer'.
src/daemon/common.c | diff | blob | history |