From: David Lawrence Ramsey Date: Fri, 26 May 2006 13:49:00 +0000 (+0000) Subject: in parse_rcfile(), properly handle rcfiles that don't end in newlines X-Git-Tag: v1.3.12~104 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5566e442b1e55d2c13746b1ea795d27a2c655b59;p=nano.git in parse_rcfile(), properly handle rcfiles that don't end in newlines git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3576 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 091455b8..b2af78fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -262,6 +262,7 @@ CVS code - any associated color commands. (DLR) - Change variable i from an int to a size_t, for consistency. (DLR) + - Properly handle rcfiles that don't end in newlines. (DLR) do_rcfile() - Check for the rcfile's being a directory or device file and reject it if it is, for consistency with file handling diff --git a/src/rcfile.c b/src/rcfile.c index 5996b334..bebf2b99 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -622,7 +622,8 @@ void parse_rcfile(FILE *rcstream size_t i; /* Ignore the newline. */ - buf[len - 1] = '\0'; + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; lineno++; ptr = buf;