]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Added the ability to read the configuration file
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Thu, 9 Apr 2009 21:11:14 +0000 (21:11 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Thu, 9 Apr 2009 21:11:14 +0000 (21:11 +0000)
from stdin, when "stdin" is given as the config
file name.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@4127 e7ae566f-a301-0410-adde-c780ea21d3b5

options.c

index 9ca146f5022cf2736803c6e7a021c6b793143838..758a078f9262c51bb9f8a869dc1bb9ff0ac35cea 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3058,7 +3058,10 @@ read_config_file (struct options *options,
   ++level;
   if (level <= max_recursive_levels)
     {
-      fp = fopen (file, "r");
+      if (streq (file, "stdin"))
+       fp = stdin;
+      else
+       fp = fopen (file, "r");
       if (fp)
        {
          line_num = 0;
@@ -3075,7 +3078,8 @@ read_config_file (struct options *options,
                  add_option (options, p, file, line_num, level, msglevel, permission_mask, option_types_found, es);
                }
            }
-         fclose (fp);
+         if (fp != stdin)
+           fclose (fp);
        }
       else
        {