diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-07-25 09:51:14 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-07-25 09:51:14 +0100 |
commit | 504e6b5eae079a93ac47fe2f1a228db6ff9b1aca (patch) | |
tree | fd1ea73e6bf476945ade0b02538680fee493e74a /tools/xenstore/xenstored_core.c | |
parent | 698543a3139d11d724d2b7b0622a7ea42051a696 (diff) | |
download | xen-504e6b5eae079a93ac47fe2f1a228db6ff9b1aca.tar.gz xen-504e6b5eae079a93ac47fe2f1a228db6ff9b1aca.tar.bz2 xen-504e6b5eae079a93ac47fe2f1a228db6ff9b1aca.zip |
xenstored: Fix socket-based connection teardown. Reading zero bytes
*should* in fact cause the connection to be destroyed. Fix this with a
little extra code in the readfd() handler.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_core.c')
-rw-r--r-- | tools/xenstore/xenstored_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 1081103459..f34a698cb4 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1368,6 +1368,12 @@ static int readfd(struct connection *conn, void *data, unsigned int len) break; } + /* Reading zero length means we're done with this connection. */ + if ((rc == 0) && (len != 0)) { + errno = EBADF; + rc = -1; + } + return rc; } |