Web lists-archives.com

[MPlayer-dev-eng] [PATCH] fix parsing cookies on win32


The cookie parser checks whether the file size is equal to
read size, this is not always true on win32 if the cookie
file has windows line endings.

The parser is kind enough to parse cookies files with
windows line endings, but the file should be opened in
binary mode or the check will fail.

The attached patch fixes the problem.

Perhaps please consider to remove the attempt to load
cookies from mozilla profile since nowadays paths are different
and the cookies are not even in a text file.
The function is load_cookies()


Gianluigi Tiesi <sherpya@xxxxxxxxxx>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
diff --git a/stream/cookies.c b/stream/cookies.c
index 1ee5a58..480fdf8 100644
--- a/stream/cookies.c
+++ b/stream/cookies.c
@@ -115,7 +115,7 @@ static char *load_file(const char *filename, off_t * length)
     mp_msg(MSGT_NETWORK, MSGL_V, "Loading cookie file: %s\n", filename);
-    fd = open(filename, O_RDONLY);
+    fd = open(filename, O_RDONLY | O_BINARY);
     if (fd < 0) {
 	mp_msg(MSGT_NETWORK, MSGL_V, "Could not open");
 	goto err_out;
MPlayer-dev-eng mailing list