diff options
Diffstat (limited to 'lib/membuff.c')
-rw-r--r-- | lib/membuff.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/membuff.c b/lib/membuff.c index 36dc43a523f..b242a38ff1c 100644 --- a/lib/membuff.c +++ b/lib/membuff.c @@ -6,7 +6,6 @@ * Copyright (c) 1992 Simon Glass */ -#include <common.h> #include <errno.h> #include <log.h> #include <malloc.h> @@ -288,7 +287,7 @@ int membuff_free(struct membuff *mb) (mb->end - mb->start) - 1 - membuff_avail(mb); } -int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch) +int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit) { int len; /* number of bytes read (!= string length) */ char *s, *end; @@ -310,7 +309,7 @@ int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch) } /* couldn't get the whole string */ - if (!ok) { + if (!ok && must_fit) { if (maxlen) *orig = '\0'; return 0; |