summaryrefslogtreecommitdiff
path: root/file_io/unix
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2013-10-23 00:19:36 +0000
committerJeff Trawick <trawick@apache.org>2013-10-23 00:19:36 +0000
commit53e3bf8650ead2f5269e77831e8c32f238c6233b (patch)
treebdace55b822258a1a7d07f52935140736b573218 /file_io/unix
parente4cafbc1d5228e51d22216be80b12f5c79545613 (diff)
downloadapr-53e3bf8650ead2f5269e77831e8c32f238c6233b.tar.gz
clang scan-build noted that we sometimes assigned garbage
to the mutex field, since the conditions under which we got the mutex vs. accessed it were different; simplify git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1534873 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix')
-rw-r--r--file_io/unix/open.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/file_io/unix/open.c b/file_io/unix/open.c
index 36be4a706..b7e5bd898 100644
--- a/file_io/unix/open.c
+++ b/file_io/unix/open.c
@@ -97,7 +97,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new,
apr_os_file_t fd;
int oflags = 0;
#if APR_HAS_THREADS
- apr_thread_mutex_t *thlock;
+ apr_thread_mutex_t *thlock = NULL;
#endif
apr_status_t rv;
@@ -217,16 +217,15 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new,
if ((*new)->buffered) {
(*new)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE);
(*new)->bufsize = APR_FILE_DEFAULT_BUFSIZE;
-#if APR_HAS_THREADS
- if ((*new)->flags & APR_FOPEN_XTHREAD) {
- (*new)->thlock = thlock;
- }
-#endif
}
else {
(*new)->buffer = NULL;
}
+#if APR_HAS_THREADS
+ (*new)->thlock = thlock;
+#endif
+
(*new)->is_pipe = 0;
(*new)->timeout = -1;
(*new)->ungetchar = -1;