# HG changeset patch # User Herman Bloggs # Date 1100797540 0 # Node ID 7ff9b8b22e7d9772c8f9abea11a5f5673b60de20 # Parent ddf002ce58b61f8d94de2af4b2b2eddca3109509 [gaim-migrate @ 11324] gaim_mkstemp can now create binary files committer: Tailor Script diff -r ddf002ce58b6 -r 7ff9b8b22e7d src/gtkprefs.c --- a/src/gtkprefs.c Wed Nov 17 23:54:24 2004 +0000 +++ b/src/gtkprefs.c Thu Nov 18 17:05:40 2004 +0000 @@ -530,7 +530,7 @@ FILE *f; gchar *path; - f = gaim_mkstemp(&path); + f = gaim_mkstemp(&path, TRUE); fwrite(themedata, len, 1, f); fclose(f); diff -r ddf002ce58b6 -r 7ff9b8b22e7d src/protocols/msn/notification.c --- a/src/protocols/msn/notification.c Wed Nov 17 23:54:24 2004 +0000 +++ b/src/protocols/msn/notification.c Thu Nov 18 17:05:40 2004 +0000 @@ -778,7 +778,7 @@ g_free(session->passport_info.file); } - if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL) + if ((fd = gaim_mkstemp(&session->passport_info.file, FALSE)) == NULL) { gaim_debug(GAIM_DEBUG_ERROR, "msn", "Error opening temp passport file: %s\n", diff -r ddf002ce58b6 -r 7ff9b8b22e7d src/util.c --- a/src/util.c Wed Nov 17 23:54:24 2004 +0000 +++ b/src/util.c Thu Nov 18 17:05:40 2004 +0000 @@ -1942,7 +1942,7 @@ static const char *gaim_mkstemp_templ = {"gaimXXXXXX"}; FILE * -gaim_mkstemp(char **fpath) +gaim_mkstemp(char **fpath, gboolean binary) { const gchar *tmpdir; #ifndef _WIN32 @@ -1961,7 +1961,7 @@ "Problem creating the template\n"); else { - if( (fp = fopen( result, "w+" )) == NULL ) { + if( (fp = fopen( result, binary?"wb+":"w+")) == NULL ) { gaim_debug(GAIM_DEBUG_ERROR, "gaim_mkstemp", "Couldn't fopen() %s\n", result); } diff -r ddf002ce58b6 -r 7ff9b8b22e7d src/util.h --- a/src/util.h Wed Nov 17 23:54:24 2004 +0000 +++ b/src/util.h Thu Nov 18 17:05:40 2004 +0000 @@ -387,11 +387,12 @@ * done, as well as freeing the space pointed to by @a path with * g_free(). * - * @param path The returned path to the temp file. + * @param path The returned path to the temp file. + * @param binary Text or binary, for platforms where it matters. * * @return A file pointer to the temporary file, or @c NULL on failure. */ -FILE *gaim_mkstemp(char **path); +FILE *gaim_mkstemp(char **path, gboolean binary); /** * Checks if the given program name is valid and executable.