File: r1712790-serf_bucket_aggregate_prepend-empty-list

package info (click to toggle)
serf 1.3.10-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,380 kB
  • sloc: ansic: 17,446; python: 60; sh: 50; makefile: 48
file content (34 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: Make serf_bucket_aggregate_prepend() behave properly when prepending a bucket to an empty list
Origin: upstream, https://svn.apache.org/viewvc?view=revision&revision=1712790

Index: serf/buckets/aggregate_buckets.c
===================================================================
--- serf.orig/buckets/aggregate_buckets.c
+++ serf/buckets/aggregate_buckets.c
@@ -154,6 +154,8 @@ void serf_bucket_aggregate_prepend(
     new_list->bucket = prepend_bucket;
     new_list->next = ctx->list;
 
+    if (ctx->list == NULL)
+        ctx->last = new_list;
     ctx->list = new_list;
 }
 
@@ -283,6 +285,8 @@ static apr_status_t read_aggregate(serf_
 
             /* If we have no more in our list, return EOF. */
             if (!ctx->list) {
+                ctx->last = NULL;
+
                 if (ctx->hold_open) {
                     return ctx->hold_open(ctx->hold_open_baton, bucket);
                 }
@@ -395,6 +399,8 @@ static apr_status_t serf_aggregate_readl
 
             /* If we have no more in our list, return EOF. */
             if (!ctx->list) {
+                ctx->last = NULL;
+
                 if (ctx->hold_open) {
                     return ctx->hold_open(ctx->hold_open_baton, bucket);
                 }