summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhasso <hasso>2004-06-20 19:54:37 +0000
committerhasso <hasso>2004-06-20 19:54:37 +0000
commit320ec10a24d8dd81d0aa011dc92e07877e4e02f8 (patch)
tree867cc29d5981b58bad9392cb7eb471daeb8250a1 /lib
parent6c0f9a782a7be49de53b5ae00980990d96edbf03 (diff)
Removing code which looked at current dir for config file before attempting
to read system one.
Diffstat (limited to 'lib')
-rw-r--r--lib/vty.c146
-rw-r--r--lib/vty.h2
2 files changed, 62 insertions, 86 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 4b23487d..761ca4c2 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2208,8 +2208,7 @@ vty_use_backup_config (char *fullpath)
/* Read up configuration file from file_name. */
void
vty_read_config (char *config_file,
- char *config_current_dir,
- char *config_default_dir)
+ char *config_default_dir)
{
char cwd[MAXPATHLEN];
FILE *confp = NULL;
@@ -2219,101 +2218,78 @@ vty_read_config (char *config_file,
if (config_file != NULL)
{
if (! IS_DIRECTORY_SEP (config_file[0]))
- {
- getcwd (cwd, MAXPATHLEN);
- fullpath = XMALLOC (MTYPE_TMP,
- strlen (cwd) + strlen (config_file) + 2);
- sprintf (fullpath, "%s/%s", cwd, config_file);
- }
+ {
+ getcwd (cwd, MAXPATHLEN);
+ fullpath = XMALLOC (MTYPE_TMP,
+ strlen (cwd) + strlen (config_file) + 2);
+ sprintf (fullpath, "%s/%s", cwd, config_file);
+ }
else
- fullpath = config_file;
+ fullpath = config_file;
confp = fopen (fullpath, "r");
if (confp == NULL)
- {
- confp = vty_use_backup_config (fullpath);
- if (confp)
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- else
- {
- fprintf (stderr, "can't open configuration file [%s]\n",
- config_file);
- exit(1);
- }
- }
+ {
+ confp = vty_use_backup_config (fullpath);
+ if (confp)
+ fprintf (stderr, "WARNING: using backup configuration file!\n");
+ else
+ {
+ fprintf (stderr, "can't open configuration file [%s]\n",
+ config_file);
+ exit(1);
+ }
+ }
}
else
{
- /* Relative path configuration file open. */
- if (config_current_dir)
- {
- confp = fopen (config_current_dir, "r");
- if (confp == NULL)
- {
- confp = vty_use_backup_config (config_current_dir);
- if (confp)
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- }
- }
-
- /* If there is no relative path exists, open system default file. */
- if (confp == NULL)
- {
#ifdef VTYSH
- int ret;
- struct stat conf_stat;
-
- /* !!!!PLEASE LEAVE!!!!
- This is NEEDED for use with vtysh -b, or else you can get
- a real configuration food fight with a lot garbage in the
- merged configuration file it creates coming from the per
- daemon configuration files. This also allows the daemons
- to start if there default configuration file is not
- present or ignore them, as needed when using vtysh -b to
- configure the daemons at boot - MAG */
-
- /* Stat for vtysh Zebra.conf, if found startup and wait for
- boot configuration */
-
- if ( strstr(config_default_dir, "vtysh") == NULL)
- {
- ret = stat (integrate_default, &conf_stat);
- if (ret >= 0)
- {
- return;
- }
- }
+ int ret;
+ struct stat conf_stat;
+
+ /* !!!!PLEASE LEAVE!!!!
+ * This is NEEDED for use with vtysh -b, or else you can get
+ * a real configuration food fight with a lot garbage in the
+ * merged configuration file it creates coming from the per
+ * daemon configuration files. This also allows the daemons
+ * to start if there default configuration file is not
+ * present or ignore them, as needed when using vtysh -b to
+ * configure the daemons at boot - MAG
+ */
+
+ /* Stat for vtysh Zebra.conf, if found startup and wait for
+ * boot configuration
+ */
+
+ if ( strstr(config_default_dir, "vtysh") == NULL)
+ {
+ ret = stat (integrate_default, &conf_stat);
+ if (ret >= 0)
+ return;
+ }
#endif /* VTYSH */
- confp = fopen (config_default_dir, "r");
- if (confp == NULL)
- {
- confp = vty_use_backup_config (config_default_dir);
- if (confp)
- {
- fprintf (stderr, "WARNING: using backup configuration file!\n");
- fullpath = config_default_dir;
- }
- else
- {
- fprintf (stderr, "can't open configuration file [%s]\n",
- config_default_dir);
- exit (1);
- }
- }
- else
- fullpath = config_default_dir;
- }
+ confp = fopen (config_default_dir, "r");
+ if (confp == NULL)
+ {
+ confp = vty_use_backup_config (config_default_dir);
+ if (confp)
+ {
+ fprintf (stderr, "WARNING: using backup configuration file!\n");
+ fullpath = config_default_dir;
+ }
+ else
+ {
+ fprintf (stderr, "can't open configuration file [%s]\n",
+ config_default_dir);
+ exit (1);
+ }
+ }
else
- {
- /* Rleative path configuration file. */
- getcwd (cwd, MAXPATHLEN);
- fullpath = XMALLOC (MTYPE_TMP,
- strlen (cwd) + strlen (config_current_dir) + 2);
- sprintf (fullpath, "%s/%s", cwd, config_current_dir);
- }
- }
+ fullpath = config_default_dir;
+ }
+
vty_read_file (confp);
fclose (confp);
diff --git a/lib/vty.h b/lib/vty.h
index fedfb3ed..3cf9c4a2 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -192,7 +192,7 @@ void vty_reset (void);
void vty_finish (void);
struct vty *vty_new (void);
int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
-void vty_read_config (char *, char *, char *);
+void vty_read_config (char *, char *);
void vty_time_print (struct vty *, int);
void vty_serv_sock (const char *, unsigned short, char *);
void vty_close (struct vty *);