summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaul <paul>2005-03-08 16:00:12 +0000
committerpaul <paul>2005-03-08 16:00:12 +0000
commitf318bd1f3e2cf5220ee40e044a6a07236779a5b3 (patch)
tree2288a3cd4a06b4ccd932425cb561fedc5715f8d8
parent7c1363d6a775ae1d6c9101576d26b1a37b89a1f9 (diff)
downloadquagga-f318bd1f3e2cf5220ee40e044a6a07236779a5b3.tar.bz2
quagga-f318bd1f3e2cf5220ee40e044a6a07236779a5b3.tar.xz
2005-03-08 Paul Jakma <paul.jakma@sun.com>
* command.c: (no_banner_motd_cmd) use XFREE. * vty.c: (vty_hello) fix the indentation and comment.
-rw-r--r--lib/ChangeLog1
-rw-r--r--lib/command.c3
-rw-r--r--lib/vty.c14
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 03ca581f..1092844f 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,6 +1,7 @@
2005-03-08 Paul Jakma <paul.jakma@sun.com>
* command.c: (banner_motd_file_cmd) use XSTRDUP/XFREE.
+ (no_banner_motd_cmd) use XFREE.
(cmd_describe_command_real) sign compile warning fix
(cmd_complete_command_real) ditto.
(config_list_cmd) Don't list hidden or deprecated commands,
diff --git a/lib/command.c b/lib/command.c
index 15c06655..fed40be5 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -3437,7 +3437,8 @@ DEFUN (no_banner_motd,
"Strings for motd\n")
{
host.motd = NULL;
- if (host.motdfile) free(host.motdfile);
+ if (host.motdfile)
+ XFREE (MTYPE_TMP, host.motdfile);
host.motdfile = NULL;
return CMD_SUCCESS;
}
diff --git a/lib/vty.c b/lib/vty.c
index 2ea24b8e..89a941ca 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -220,19 +220,19 @@ vty_hello (struct vty *vty)
{
FILE *f;
char buf[4096];
-
+
f = fopen (host.motdfile, "r");
if (f)
{
while (fgets (buf, sizeof (buf), f))
{
char *s;
- /* work backwards and squash all isspace() chars
- * we want nul terminated for vty_out */
- for (s = buf+strlen(buf); (s > buf) && isspace(*(s-1)); s--);
- *s = '\0';
- vty_out (vty, "%s%s", buf, VTY_NEWLINE);
- }
+ /* work backwards to ignore trailling isspace() */
+ for (s = buf + strlen (buf); (s > buf) && isspace (*(s - 1));
+ s--);
+ *s = '\0';
+ vty_out (vty, "%s%s", buf, VTY_NEWLINE);
+ }
fclose (f);
}
else