summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/file.c b/file.c
index 29bbea5a8..5e8ab381f 100644
--- a/file.c
+++ b/file.c
@@ -423,9 +423,14 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
valueptr += 2;
}
if ((endptr = strstr(lineptr, "\n")) != NULL) {
+ char terminator = '\n';
+ if (*(endptr - 1) == '\r') {
+ --endptr;
+ terminator = '\r';
+ }
*endptr = 0;
ret = strdup(valueptr);
- *endptr = '\n';
+ *endptr = terminator;
}
}