Mercurial > pidgin
changeset 16860:86ba72a2b31e
merge of '27e1df003532e1209f1f56770923ca4c7674d7ca'
and 'ace1e60dda39081ec5404dfa76fa55f79b3e30c6'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 04 May 2007 04:02:14 +0000 |
parents | ec79e3ad09a9 (diff) f51f1937d97f (current diff) |
children | 38b3ca4b353d |
files | |
diffstat | 1 files changed, 5 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/util.c Fri May 04 03:58:29 2007 +0000 +++ b/libpurple/util.c Fri May 04 04:02:14 2007 +0000 @@ -2522,9 +2522,7 @@ purple_mkstemp(char **fpath, gboolean binary) { const gchar *tmpdir; -#ifndef _WIN32 int fd; -#endif FILE *fp = NULL; g_return_val_if_fail(fpath != NULL, NULL); @@ -2532,19 +2530,11 @@ if((tmpdir = (gchar*)g_get_tmp_dir()) != NULL) { if((*fpath = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", tmpdir, purple_mkstemp_templ)) != NULL) { #ifdef _WIN32 - char* result = _mktemp( *fpath ); - if( result == NULL ) - purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp", - "Problem creating the template\n"); - else - { - if( (fp = g_fopen( result, binary?"wb+":"w+")) == NULL ) { - purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp", - "Couldn't fopen() %s\n", result); - } - } + fd = g_mkstemp(*fpath); #else - if((fd = mkstemp(*fpath)) == -1) { + fd = mkstemp(*fpath)); +#endif + if(fd == -1) { purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp", "Couldn't make \"%s\", error: %d\n", *fpath, errno); @@ -2555,7 +2545,7 @@ "Couldn't fdopen(), error: %d\n", errno); } } -#endif + if(!fp) { g_free(*fpath); *fpath = NULL;