Author: fejj
Date: 2008-02-05 16:39:19 -0500 (Tue, 05 Feb 2008)
New Revision: 94959
Modified:
trunk/moon/src/downloader.cpp
Log:
oops, forgot to unzOPenCurrentFile()
Modified: trunk/moon/src/downloader.cpp
===================================================================
--- trunk/moon/src/downloader.cpp 2008-02-05 21:36:21 UTC (rev 94958)
+++ trunk/moon/src/downloader.cpp 2008-02-05 21:39:19 UTC (rev 94959)
@@ -156,7 +156,7 @@
char *
Downloader::ll_downloader_get_response_file (const char *PartName)
{
- char *tmpname = NULL;
+ char *name, *tmpname = NULL;
unzFile zipfile;
int fd;
@@ -177,22 +177,34 @@
return NULL;
}
+ // open the requested part within the zip file
+ if (unzOpenCurrentFile (zipfile) != UNZ_OK) {
+ unzClose (zipfile);
+ return NULL;
+ }
+
// create a tmp file...
- tmpname = g_build_filename (g_get_tmp_dir (),
"MoonlightDownloaderStream.XXXXXX", NULL);
+ name = g_strdup_printf ("%s.XXXXXX", PartName);
+ tmpname = g_build_filename (g_get_tmp_dir (), name, NULL);
+ g_free (name);
+
if ((fd = g_mkstemp (tmpname)) == -1) {
- unzClose (zipfile);
g_free (tmpname);
- return NULL;
+ tmpname = NULL;
+ goto done;
}
// extract the file from the zip archive... (closes the fd on success
and fail)
if (!ExtractFile (zipfile, fd)) {
- unzClose (zipfile);
unlink (tmpname);
g_free (tmpname);
- return NULL;
+ tmpname = NULL;
+ goto done;
}
+done:
+
+ unzCloseCurrentFile (zipfile);
unzClose (zipfile);
return tmpname;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches