From 108a10513ef5ca961b195a66423db8d724459bd1 Mon Sep 17 00:00:00 2001 From: jorton Date: Tue, 25 Jun 2019 14:05:18 +0000 Subject: * 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 --- file_io/unix/filedup.c | 4 ++++ 1 file changed, 4 insertions(+) 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 + 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 */ -- cgit v1.2.1