Allow reading config files with CRLF endings on Unix systems.

This commit is contained in:
Guus Sliepen 2009-01-20 14:20:44 +01:00
parent d1910ac198
commit 0966cca8ab

View file

@ -301,6 +301,8 @@ static char *readline(FILE * fp, char **buf, size_t *buflen)
size = newsize; size = newsize;
} else { } else {
*newline = '\0'; /* kill newline */ *newline = '\0'; /* kill newline */
if(newline > p && newline[-1] == '\r') /* and carriage return if necessary */
newline[-1] = '\0';
break; /* yay */ break; /* yay */
} }
} }