diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2019-06-25 14:05:18 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2019-06-25 14:05:18 +0000 |
commit | 108a10513ef5ca961b195a66423db8d724459bd1 (patch) | |
tree | f685d23f7756b731251f26df2830f642b43b025e /file_io | |
parent | 45b3aa7ff230a1361f4479dcdc7dd4a26d5446c1 (diff) | |
download | libapr-108a10513ef5ca961b195a66423db8d724459bd1.tar.gz |
* file_io/unix/filedup.c (file_dup): Add assert() for possible values
of which_dup to help static analysers.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1862068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/unix/filedup.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c index 797f8045f..c68d2e970 100644 --- a/file_io/unix/filedup.c +++ b/file_io/unix/filedup.c @@ -20,6 +20,8 @@ #include "apr_thread_mutex.h" #include "apr_arch_inherit.h" +#include <assert.h> + static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p, int which_dup) @@ -29,6 +31,8 @@ static apr_status_t file_dup(apr_file_t **new_file, int flags = 0; #endif + assert(which_dup == 1 || which_dup == 2); + if (which_dup == 2) { if ((*new_file) == NULL) { /* We can't dup2 unless we have a valid new_file */ |