On 2013-02-12 02:45, Simon Horman wrote:
This corrects what appears to be logic errors in cut_crlf().
I assume that the intention of this function is to truncate a
string at the first cr or lf. However, currently lf are ignored.
If the current logic is intended then it may be simplified as:
while (*s != '\r') {
Cc: Krzysztof Piotr Oledzki <o...@ans.pl>
Signed-off-by: Simon Horman <ho...@verge.net.au>
---
include/common/standard.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/common/standard.h b/include/common/standard.h
index b1db821..d931925 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -411,7 +411,7 @@ unsigned int inetaddr_host_lim_ret(char *text, char *stop,
char **ret);
static inline char *cut_crlf(char *s) {
- while (*s != '\r' || *s == '\n') {
+ while (*s != '\r' && *s != '\n') {
char *p = s++;
if (!*p)
Wow, who wrote this!? ;) Yes, we definitely need this fix, thank you!
Also, you may want to replace:
*s++ = 0;
with:
*s++ = '\0';
And add:
while (*s == '\r' || *s == '\n')
before "*s++ = '\0';"
.. so we properly split "line1\r\nline2".
Best regards,
Krzysztof Olędzki