You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2019/06/25 14:05:19 UTC

svn commit: r1862068 - /apr/apr/trunk/file_io/unix/filedup.c

Author: jorton
Date: Tue Jun 25 14:05:18 2019
New Revision: 1862068

URL: http://svn.apache.org/viewvc?rev=1862068&view=rev
Log:
* file_io/unix/filedup.c (file_dup): Add assert() for possible values 
  of which_dup to help static analysers.

Modified:
    apr/apr/trunk/file_io/unix/filedup.c

Modified: apr/apr/trunk/file_io/unix/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/filedup.c?rev=1862068&r1=1862067&r2=1862068&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/filedup.c (original)
+++ apr/apr/trunk/file_io/unix/filedup.c Tue Jun 25 14:05:18 2019
@@ -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
     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 */