]> granicus.if.org Git - apache/commitdiff
drop the test, whether apr_brigade_create returns NULL. It does never
authorAndré Malo <nd@apache.org>
Wed, 6 Aug 2003 21:38:58 +0000 (21:38 +0000)
committerAndré Malo <nd@apache.org>
Wed, 6 Aug 2003 21:38:58 +0000 (21:38 +0000)
(dumps core instead :-)

Submitted by: Cliff Woolley

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100924 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/main/mod_dav.c

index bdccd76727586a042c3e2e77ea34beb63ba99d06..62901ffc52bc041bd8bf756275795b4c982fc8fa 100644 (file)
@@ -985,56 +985,49 @@ static int dav_method_put(request_rec *r)
 
         bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
 
-        if (!bb) {
-            err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
-                                "Could not create bucket brigade");
-        }
-        else {
-            do {
-                apr_status_t rc;
+        do {
+            apr_status_t rc;
 
-                rc = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
-                                    APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
+            rc = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
+                                APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
 
-                if (rc != APR_SUCCESS) {
-                    err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
-                                        "Could not get next bucket brigade");
-                    break;
-                }
+            if (rc != APR_SUCCESS) {
+                err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+                                    "Could not get next bucket brigade");
+                break;
+            }
 
-                APR_BRIGADE_FOREACH(b, bb) {
-                    const char *data;
-                    apr_size_t len;
+            APR_BRIGADE_FOREACH(b, bb) {
+                const char *data;
+                apr_size_t len;
 
-                    if (APR_BUCKET_IS_EOS(b)) {
-                        seen_eos = 1;
-                        break;
-                    }
+                if (APR_BUCKET_IS_EOS(b)) {
+                    seen_eos = 1;
+                    break;
+                }
 
-                    if (APR_BUCKET_IS_METADATA(b)) {
-                        continue;
-                    }
+                if (APR_BUCKET_IS_METADATA(b)) {
+                    continue;
+                }
 
-                    rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
-                    if (rc != APR_SUCCESS) {
-                        err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
-                                            "An error occurred while reading "
-                                            "the request body.");
-                        break;
-                    }
+                rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
+                if (rc != APR_SUCCESS) {
+                    err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+                                        "An error occurred while reading "
+                                        "the request body.");
+                    break;
+                }
 
-                    if (err == NULL) {
-                        /* write whatever we read, until we see an error */
-                        err = (*resource->hooks->write_stream)(stream, data,
-                                                               len);
-                    }
+                if (err == NULL) {
+                    /* write whatever we read, until we see an error */
+                    err = (*resource->hooks->write_stream)(stream, data, len);
                 }
+            }
 
-                apr_brigade_cleanup(bb);
-            } while (!seen_eos);
+            apr_brigade_cleanup(bb);
+        } while (!seen_eos);
 
-            apr_brigade_destroy(bb);
-        }
+        apr_brigade_destroy(bb);
 
         err2 = (*resource->hooks->close_stream)(stream,
                                                 err == NULL /* commit */);