Browse code

cleanup: Remove faulty env processing functions

The env_set_add_to_environmenti() and env_set_remove_from_environment()
functions where not used in the code at all and they would cause an
ASSERT() in setenv_str_ex() later on, as it would not allow the
struct env_set *es pointer to be NULL (misc.c:807).

Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170225020229.17287-1-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14195.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

David Sommerseth authored on 2017/02/25 11:02:29
Showing 2 changed files
... ...
@@ -701,57 +701,6 @@ env_set_inherit(struct env_set *es, const struct env_set *src)
701 701
     }
702 702
 }
703 703
 
704
-void
705
-env_set_add_to_environment(const struct env_set *es)
706
-{
707
-    if (es)
708
-    {
709
-        struct gc_arena gc = gc_new();
710
-        const struct env_item *e;
711
-
712
-        e = es->list;
713
-
714
-        while (e)
715
-        {
716
-            const char *name;
717
-            const char *value;
718
-
719
-            if (deconstruct_name_value(e->string, &name, &value, &gc))
720
-            {
721
-                setenv_str(NULL, name, value);
722
-            }
723
-
724
-            e = e->next;
725
-        }
726
-        gc_free(&gc);
727
-    }
728
-}
729
-
730
-void
731
-env_set_remove_from_environment(const struct env_set *es)
732
-{
733
-    if (es)
734
-    {
735
-        struct gc_arena gc = gc_new();
736
-        const struct env_item *e;
737
-
738
-        e = es->list;
739
-
740
-        while (e)
741
-        {
742
-            const char *name;
743
-            const char *value;
744
-
745
-            if (deconstruct_name_value(e->string, &name, &value, &gc))
746
-            {
747
-                setenv_del(NULL, name);
748
-            }
749
-
750
-            e = e->next;
751
-        }
752
-        gc_free(&gc);
753
-    }
754
-}
755 704
 
756 705
 /* add/modify/delete environmental strings */
757 706
 
... ...
@@ -161,10 +161,6 @@ void env_set_print(int msglevel, const struct env_set *es);
161 161
 
162 162
 void env_set_inherit(struct env_set *es, const struct env_set *src);
163 163
 
164
-void env_set_add_to_environment(const struct env_set *es);
165
-
166
-void env_set_remove_from_environment(const struct env_set *es);
167
-
168 164
 /* Make arrays of strings */
169 165
 
170 166
 const char **make_env_array(const struct env_set *es,