summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2017-08-29 13:49:03 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2017-08-29 13:49:03 +0000
commit9141dcde6df812a32563faaad74c3f04a7b314e9 (patch)
tree1d6029762e078df308847838a300a6bb1488370e /file_io
parent0ddf0fcb2d039b0f14eab348744d57a8f13ad184 (diff)
downloadlibapr-9141dcde6df812a32563faaad74c3f04a7b314e9.tar.gz
Minor refactoring of the Win32 file write code.
* file_io/win32/readwrite.c (apr_file_write): Reuse the existing 'rv' variable to store the status code. Reduce the scope of the 'offset' variable. Patch by: Evgeny Kotkov <evgeny.kotkov {at} visualsvn.com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1806592 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/readwrite.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c
index 8e9ab6f47..8daa220de 100644
--- a/file_io/win32/readwrite.c
+++ b/file_io/win32/readwrite.c
@@ -372,24 +372,24 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
return rv;
} else {
if (!thefile->pipe) {
- apr_off_t offset = 0;
- apr_status_t rc;
if (thefile->append) {
+ apr_off_t offset = 0;
+
/* apr_file_lock will mutex the file across processes.
* The call to apr_thread_mutex_lock is added to avoid
* a race condition between LockFile and WriteFile
* that occasionally leads to deadlocked threads.
*/
apr_thread_mutex_lock(thefile->mutex);
- rc = apr_file_lock(thefile, APR_FLOCK_EXCLUSIVE);
- if (rc != APR_SUCCESS) {
+ rv = apr_file_lock(thefile, APR_FLOCK_EXCLUSIVE);
+ if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(thefile->mutex);
- return rc;
+ return rv;
}
- rc = apr_file_seek(thefile, APR_END, &offset);
- if (rc != APR_SUCCESS) {
+ rv = apr_file_seek(thefile, APR_END, &offset);
+ if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(thefile->mutex);
- return rc;
+ return rv;
}
}
if (thefile->pOverlapped) {