From 30f8aa646039547fadf1c556b4ad43d6595eaa3f Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Fri, 15 Nov 2013 22:03:16 +0000 Subject: [PATCH] more apr_file_write_full() simplification (like r1542413) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542416 13f79535-47bb-0310-9956-ffa450edef68 --- modules/dav/fs/lock.c | 6 ++---- modules/debugging/mod_firehose.c | 3 +-- modules/loggers/mod_log_forensic.c | 14 ++++++-------- server/mpm/winnt/mpm_winnt.c | 9 ++++----- support/firehose.c | 2 +- support/rotatelogs.c | 2 +- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c index a15b4b91c7..2da3ceba9a 100644 --- a/modules/dav/fs/lock.c +++ b/modules/dav/fs/lock.c @@ -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 diff --git a/modules/debugging/mod_firehose.c b/modules/debugging/mod_firehose.c index 7400601f8a..a9a63303ca 100644 --- a/modules/debugging/mod_firehose.c +++ b/modules/debugging/mod_firehose.c @@ -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 */ diff --git a/modules/loggers/mod_log_forensic.c b/modules/loggers/mod_log_forensic.c index f29aec3ef7..359cd63935 100644 --- a/modules/loggers/mod_log_forensic.c +++ b/modules/loggers/mod_log_forensic.c @@ -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; } diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index e532dac923..43638c0880 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -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"); diff --git a/support/firehose.c b/support/firehose.c index 08e57db835..b78a9d838b 100644 --- a/support/firehose.c +++ b/support/firehose.c @@ -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); diff --git a/support/rotatelogs.c b/support/rotatelogs.c index 0092e8c711..e4953963fb 100644 --- a/support/rotatelogs.c +++ b/support/rotatelogs.c @@ -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); } -- 2.40.0