From: Guus Sliepen Date: Tue, 20 Jan 2009 13:20:44 +0000 (+0100) Subject: Allow reading config files with CRLF endings on Unix systems. X-Git-Tag: import-tinc-1.1~596^2~9 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=0966cca8ab6dcde2747c717f21d73fd332e04242;p=meshlink Allow reading config files with CRLF endings on Unix systems. --- diff --git a/src/conf.c b/src/conf.c index 052b20f9..a61a3591 100644 --- a/src/conf.c +++ b/src/conf.c @@ -301,6 +301,8 @@ static char *readline(FILE * fp, char **buf, size_t *buflen) size = newsize; } else { *newline = '\0'; /* kill newline */ + if(newline > p && newline[-1] == '\r') /* and carriage return if necessary */ + newline[-1] = '\0'; break; /* yay */ } }