aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-28 20:03:54 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-01 18:35:18 -0700
commit3682efe7a705043f9005c456cfc806aeefa788ff (patch)
treed01423ec6874e543f7e0e50f74fbbb07d6311ae8
parent7ff63fec2ca1c2c45d28a1907ab1e08e0356996e (diff)
downloadmpd-3682efe7a705043f9005c456cfc806aeefa788ff.tar.gz
mpd-3682efe7a705043f9005c456cfc806aeefa788ff.tar.xz
mpd-3682efe7a705043f9005c456cfc806aeefa788ff.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.
-rw-r--r--src/client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c
index 586d4d212..6457fb373 100644
--- a/src/client.c
+++ b/src/client.c
@@ -719,7 +719,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);
@@ -732,11 +732,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)