reduce scope of variable. Found by PVS-Studio
authorAlan T. DeKok <aland@freeradius.org>
Wed, 17 May 2017 16:15:07 +0000 (12:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 19 May 2017 18:06:54 +0000 (14:06 -0400)
src/main/exec.c

index 77fdd2e..d5b3a9a 100644 (file)
@@ -86,7 +86,6 @@ pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait,
                           VALUE_PAIR *input_pairs, bool shell_escape)
 {
 #ifndef __MINGW32__
-       char *p;
        VALUE_PAIR *vp;
        int n;
        int to_child[2] = {-1, -1};
@@ -169,6 +168,8 @@ pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait,
                         */
                        snprintf(buffer, sizeof(buffer), "%s=", vp->da->name);
                        if (shell_escape) {
+                               char *p;
+
                                for (p = buffer; *p != '='; p++) {
                                        if (*p == '-') {
                                                *p = '_';