summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2019-06-25 14:05:18 +0000
committerJoe Orton <jorton@apache.org>2019-06-25 14:05:18 +0000
commite0f71494adc916c15fca5038ac1e45b77113168c (patch)
treef685d23f7756b731251f26df2830f642b43b025e /file_io
parent92c39125e444c5ea3468bce7035fcef824b90089 (diff)
downloadapr-e0f71494adc916c15fca5038ac1e45b77113168c.tar.gz
* file_io/unix/filedup.c (file_dup): Add assert() for possible values
of which_dup to help static analysers. git-svn-id: https://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.c4
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 */