summaryrefslogtreecommitdiff
path: root/src/librc/librc-misc.c
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 /src/librc/librc-misc.c
parentfa898af7916ca05235bbd086a938952952d525ae (diff)
downloadopenrc-81b8e5450e2aee2a35a1913e3e051e4c4cd22ece.tar.gz
openrc-81b8e5450e2aee2a35a1913e3e051e4c4cd22ece.tar.bz2
openrc-81b8e5450e2aee2a35a1913e3e051e4c4cd22ece.tar.xz
Really fix off by one error.
Diffstat (limited to 'src/librc/librc-misc.c')
-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 afd078d..f77b2f7 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);