aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-28 20:03:54 +0200
committerMax Kellermann <max@duempel.org>2008-08-28 20:03:54 +0200
commit20f06162dd6e301c539e6275dd93f05736f42925 (patch)
tree6166008ad3055d3ae09fe3c17b9cfee5518b2ad9 /src/client.c
parent7774cd27749357dd898852ddd99e428c59b67d0b (diff)
downloadmpd-20f06162dd6e301c539e6275dd93f05736f42925.tar.gz
mpd-20f06162dd6e301c539e6275dd93f05736f42925.tar.xz
mpd-20f06162dd6e301c539e6275dd93f05736f42925.zip
client: return early on error in client_defer_output()
Exit the function when an error occurs, and move the rest of the following code one indent level left.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c
index da1358e54..2aa52de4f 100644
--- a/src/client.c
+++ b/src/client.c
@@ -722,7 +722,7 @@ int client_print(int fd, const char *buffer, size_t buflen)
static void client_defer_output(struct client *client,
const void *data, size_t length)
{
- struct sllnode *buf = client->deferred_send;
+ struct sllnode *buf;
assert(client->deferred_send != NULL);
@@ -735,11 +735,13 @@ static void client_defer_output(struct client *client,
(unsigned long)client_max_output_buffer_size);
/* cause client to close */
client->expired = 1;
- } else {
- while (buf->next)
- buf = buf->next;
- buf->next = new_sllnode(data, length);
+ return;
}
+
+ buf = client->deferred_send;
+ while (buf->next)
+ buf = buf->next;
+ buf->next = new_sllnode(data, length);
}
static void client_write_output(struct client *client)