aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-07 15:27:26 +0000
committerRoy Marples <roy@marples.name>2008-01-07 15:27:26 +0000
commit81b8e5450e2aee2a35a1913e3e051e4c4cd22ece (patch)
tree6b3f67bec0ef54ac1f4e4be7f55e0bb27fb2a666
parentfa898af7916ca05235bbd086a938952952d525ae (diff)
Really fix off by one error.
-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);