]> granicus.if.org Git - apache/commitdiff
more apr_file_write_full() simplification (like r1542413)
authorJeff Trawick <trawick@apache.org>
Fri, 15 Nov 2013 22:03:16 +0000 (22:03 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 15 Nov 2013 22:03:16 +0000 (22:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542416 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/fs/lock.c
modules/debugging/mod_firehose.c
modules/loggers/mod_log_forensic.c
server/mpm/winnt/mpm_winnt.c
support/firehose.c
support/rotatelogs.c

index a15b4b91c7a18d789f03d8fd123902190af52d04..2da3ceba9a8fcd69fe3656476fbdafcaa89b5b5a 100644 (file)
@@ -812,7 +812,6 @@ static dav_error * dav_fs_save_locknull_list(apr_pool_t *p, const char *dirpath,
     const char *pathname;
     apr_file_t *file = NULL;
     dav_error *err = NULL;
-    apr_size_t amt;
     apr_status_t rv;
 
     if (pbuf->buf == NULL)
@@ -844,9 +843,8 @@ static dav_error * dav_fs_save_locknull_list(apr_pool_t *p, const char *dirpath,
                                          pathname));
     }
 
-    amt = pbuf->cur_len;
-    if ((rv = apr_file_write_full(file, pbuf->buf, amt, &amt)) != APR_SUCCESS
-        || amt != pbuf->cur_len) {
+    if ((rv = apr_file_write_full(file, pbuf->buf, pbuf->cur_len, NULL)) 
+        != APR_SUCCESS) {
         err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, rv,
                             apr_psprintf(p,
                                         "Error writing %" APR_SIZE_T_FMT
index 7400601f8a00eab9a30ba3b95b4f4cb2b8eacc35..a9a63303ca73aa2ef4108bc3e4cf6cf51442683d 100644 (file)
@@ -127,7 +127,6 @@ static apr_status_t pumpit_cleanup(void *dummy)
     apr_status_t rv;
     apr_size_t hdr_len;
     char header[HEADER_LEN + 1];
-    apr_size_t bytes;
 
     if (!ctx->count) {
         return APR_SUCCESS;
@@ -138,7 +137,7 @@ static apr_status_t pumpit_cleanup(void *dummy)
             ctx->uuid, ctx->count);
     ap_xlate_proto_to_ascii(header, hdr_len);
 
-    rv = apr_file_write_full(ctx->conn->file, header, hdr_len, &bytes);
+    rv = apr_file_write_full(ctx->conn->file, header, hdr_len, NULL);
     if (APR_SUCCESS != rv) {
         if (ctx->conn->suppress) {
             /* ignore the error */
index f29aec3ef7b1acff22a0df8dd960c7b7b08f0f5c..359cd63935e4f465aee0cea7bcd8653fd4960193 100644 (file)
@@ -185,7 +185,6 @@ static int log_before(request_rec *r)
                                      &log_forensic_module);
     const char *id;
     hlog h;
-    apr_size_t n;
     apr_status_t rv;
 
     if (!cfg->fd || r->prev) {
@@ -221,9 +220,8 @@ static int log_before(request_rec *r)
     ap_assert(h.pos < h.end);
     *h.pos++ = '\n';
 
-    n = h.count-1;
-    rv = apr_file_write_full(cfg->fd, h.log, n, &n);
-    ap_assert(rv == APR_SUCCESS && n == h.count-1);
+    rv = apr_file_write_full(cfg->fd, h.log, h.count-1, NULL);
+    ap_assert(rv == APR_SUCCESS);
 
     apr_table_setn(r->notes, "forensic-id", id);
 
@@ -237,7 +235,7 @@ static int log_after(request_rec *r)
     const char *id = ap_get_module_config(r->request_config,
                                           &log_forensic_module);
     char *s;
-    apr_size_t l, n;
+    apr_size_t n;
     apr_status_t rv;
 
     if (!cfg->fd || id == NULL) {
@@ -245,9 +243,9 @@ static int log_after(request_rec *r)
     }
 
     s = apr_pstrcat(r->pool, "-", id, "\n", NULL);
-    l = n = strlen(s);
-    rv = apr_file_write_full(cfg->fd, s, n, &n);
-    ap_assert(rv == APR_SUCCESS && n == l);
+    n = strlen(s);
+    rv = apr_file_write_full(cfg->fd, s, n, NULL);
+    ap_assert(rv == APR_SUCCESS);
 
     return OK;
 }
index e532dac9231538a563a0f556cf6715c195f0db81..43638c0880471c1a556db6237fbac354bb30a4cd 100644 (file)
@@ -358,7 +358,6 @@ static int send_handles_to_child(apr_pool_t *p,
     HANDLE hDup;
     HANDLE os_start;
     HANDLE hScore;
-    apr_size_t BytesWritten;
 
     if (!DuplicateHandle(hCurrentProcess, child_ready_event, hProcess, &hDup,
         EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, 0)) {
@@ -366,7 +365,7 @@ static int send_handles_to_child(apr_pool_t *p,
                      "Parent: Unable to duplicate the ready event handle for the child");
         return -1;
     }
-    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
+    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), NULL))
             != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(00393)
                      "Parent: Unable to send the exit event handle to the child");
@@ -378,7 +377,7 @@ static int send_handles_to_child(apr_pool_t *p,
                      "Parent: Unable to duplicate the exit event handle for the child");
         return -1;
     }
-    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
+    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), NULL))
             != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(00395)
                      "Parent: Unable to send the exit event handle to the child");
@@ -395,7 +394,7 @@ static int send_handles_to_child(apr_pool_t *p,
                      "Parent: Unable to duplicate the start mutex to the child");
         return -1;
     }
-    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
+    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), NULL))
             != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(00398)
                      "Parent: Unable to send the start mutex to the child");
@@ -412,7 +411,7 @@ static int send_handles_to_child(apr_pool_t *p,
                      "Parent: Unable to duplicate the scoreboard handle to the child");
         return -1;
     }
-    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
+    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), NULL))
             != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(00401)
                      "Parent: Unable to send the scoreboard handle to the child");
index 08e57db8354d87ef11261876f987c472d1eb22aa..b78a9d838b7b46d34ae977dda049537082f91d62 100644 (file)
@@ -342,7 +342,7 @@ static apr_status_t process_body(file_rec *file, header_rec *header,
         if (APR_SUCCESS == (status = apr_file_open(&handle, native, APR_WRITE
                 | APR_CREATE | APR_APPEND, APR_OS_DEFAULT, pool))) {
             if (APR_SUCCESS != (status = apr_file_write_full(handle, str, len,
-                    &len))) {
+                    NULL))) {
                 apr_file_printf(file->file_err,
                         "Could not write fragment body to file '%s': %pm\n",
                         native, &status);
index 0092e8c711c4deb29cfce689a83f2187186c73eb..e4953963fb0997ed424b89f773f6b19dda1cb9eb 100644 (file)
@@ -762,7 +762,7 @@ int main (int argc, const char * const argv[])
             status.nMessCount++;
         }
         if (config.echo) {
-            if (apr_file_write_full(f_stdout, buf, nRead, &nWrite)) {
+            if (apr_file_write_full(f_stdout, buf, nRead, NULL)) {
                 fprintf(stderr, "Unable to write to stdout\n");
                 exit(4);
             }