summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpaul <paul>2003-10-22 02:49:38 +0000
committerpaul <paul>2003-10-22 02:49:38 +0000
commitccc9235e602ebd578fbeba3c98499b3933069d96 (patch)
treec03f38a5d99e63212a9addf54b35e04e4de34015 /lib
parentd1724b6555510c22d2df55a9245fe4e6f1b08922 (diff)
2003-10-22 Paul Jakma <paul@dishone.st>
* lib/vty.c: cleanup getcwd again. just pass the buffer in to getcwd.
Diffstat (limited to 'lib')
-rw-r--r--lib/vty.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 1c249122..deae16e3 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2202,7 +2202,7 @@ vty_read_config (char *config_file,
char *config_current_dir,
char *config_default_dir)
{
- char *cwd;
+ char cwd[MAXPATHLEN];
FILE *confp = NULL;
char *fullpath;
@@ -2211,7 +2211,7 @@ vty_read_config (char *config_file,
{
if (! IS_DIRECTORY_SEP (config_file[0]))
{
- cwd = getcwd (NULL, MAXPATHLEN);
+ getcwd (cwd, MAXPATHLEN);
fullpath = XMALLOC (MTYPE_TMP,
strlen (cwd) + strlen (config_file) + 2);
sprintf (fullpath, "%s/%s", cwd, config_file);
@@ -2299,7 +2299,7 @@ vty_read_config (char *config_file,
else
{
/* Rleative path configuration file. */
- cwd = getcwd (NULL, MAXPATHLEN);
+ getcwd (cwd, MAXPATHLEN);
fullpath = XMALLOC (MTYPE_TMP,
strlen (cwd) + strlen (config_current_dir) + 2);
sprintf (fullpath, "%s/%s", cwd, config_current_dir);
@@ -2763,13 +2763,14 @@ void
vty_save_cwd ()
{
char cwd[MAXPATHLEN];
+ char *c;
- cwd[0] = getcwd (cwd, MAXPATHLEN);
+ c = getcwd (cwd, MAXPATHLEN);
- if (!cwd)
+ if (!c)
{
chdir (SYSCONFDIR);
- cwd[0] = getcwd (cwd, MAXPATHLEN);
+ getcwd (cwd, MAXPATHLEN);
}
vty_cwd = XMALLOC (MTYPE_TMP, strlen (cwd) + 1);