mirror of
https://github.com/apache/httpd.git
synced 2025-08-01 07:26:57 +03:00
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
This commit is contained in:
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user