*** Reverted in r1806701 ***
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>
@@ -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) {
