aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/librc/librc-misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index afd078dd..f77b2f78 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -121,10 +121,10 @@ char *rc_getline (FILE *fp)
p = line + last;
fgets (p, BUFSIZ, fp);
last += strlen (p);
- } while (! feof (fp) && line[last] != '\n');
+ } while (! feof (fp) && line[last - 1] != '\n');
/* Trim the trailing newline */
- if (line[last] == '\n')
+ if (line[--last] == '\n')
line[last] = '\0';
return (line);