diff options
-rw-r--r-- | lib/ChangeLog | 1 | ||||
-rw-r--r-- | lib/command.c | 5 | ||||
-rw-r--r-- | lib/vty.c | 14 |
3 files changed, 11 insertions, 9 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 d83ebe12..cf7f46b9 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1,5 +1,5 @@ /* - $Id: command.c,v 1.40 2005/03/08 15:56:42 paul Exp $ + $Id: command.c,v 1.41 2005/03/08 16:00:12 paul Exp $ Command interpreter routine for virtual terminal [aka TeletYpe] Copyright (C) 1997, 98, 99 Kunihiro Ishiguro @@ -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; } @@ -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 |