summaryrefslogtreecommitdiff
path: root/src/libstddjb/getlnmaxsep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/getlnmaxsep.c')
-rw-r--r--src/libstddjb/getlnmaxsep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstddjb/getlnmaxsep.c b/src/libstddjb/getlnmaxsep.c
index 7b7dc0e..5ea1017 100644
--- a/src/libstddjb/getlnmaxsep.c
+++ b/src/libstddjb/getlnmaxsep.c
@@ -19,8 +19,8 @@ int getlnmaxsep (buffer *b, char *d, size_t max, size_t *w, char const *sep, siz
if (len > max - *w) len = max - *w ;
pos = siovec_bytein(v, 2, sep, seplen) ;
if (pos > len) pos = len ;
- r = pos < len ;
- buffer_getnofill(b, d + *w, pos + r) ; *w += pos ;
+ r = pos < len ; pos += r ;
+ buffer_getnofill(b, d + *w, pos) ; *w += pos ;
if (*w >= max) return (errno = ERANGE, -1) ;
if (r) return 1 ;
r = buffer_fill(b) ;