summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-04-09 21:11:14 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-04-09 21:11:14 +0000
commitf202f14370e35d58d4251c50492cf80a20037b07 (patch)
tree685ff730093f355a0903ea431e1499312a695657
parentd382bea75689dcefa8dc7d909a8b737c376f74b4 (diff)
downloadopenvpn-f202f14370e35d58d4251c50492cf80a20037b07.tar.gz
openvpn-f202f14370e35d58d4251c50492cf80a20037b07.tar.xz
openvpn-f202f14370e35d58d4251c50492cf80a20037b07.zip
Added the ability to read the configuration file
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
-rw-r--r--options.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/options.c b/options.c
index 9ca146f..758a078 100644
--- 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
{