[Pidgin] #1359: purple_mkstemp method change, now raises assertion failure ...
Pidgin
trac at pidgin.im
Mon May 28 16:53:57 EDT 2007
#1359: purple_mkstemp method change, now raises assertion failure ...
------------------------+---------------------------------------------------
Reporter: msfbrasil | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: libpurple | Version: 2.0.0
Resolution: | Keywords:
Pending: 1 |
------------------------+---------------------------------------------------
Changes (by msfbrasil):
* pending: 1 => 0
Comment:
Hello, and thank's for the post.
The failed assertion is "_ASSERTE(_osfile(filedes) & FOPEN);" on file
"fdopen.c".
One thing that I ain't told before is that our customer application and
libpurple (with associated plugins and protocols) are being build with
MSVC .net 2003.
For this reason, those binaries are linked agains msvcr71.dll, despite of
glib binaries that are linked agains msvcrt.dll.
When I change back this method implementation to the one used on gaim
2.0.0 beta 6 below, things work fine.
<-- begin code -->
FILE *
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);
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);
}
}
#else
if((fd = mkstemp(*fpath)) == -1) {
purple_debug(PURPLE_DEBUG_ERROR,
"purple_mkstemp",
"Couldn't make \"%s\",
error: %d\n",
*fpath, errno);
} else {
if((fp = fdopen(fd, "r+")) == NULL) {
close(fd);
purple_debug(PURPLE_DEBUG_ERROR,
"purple_mkstemp",
"Couldn't
fdopen(), error: %d\n", errno);
}
}
#endif
if(!fp) {
g_free(*fpath);
*fpath = NULL;
}
}
} else {
purple_debug(PURPLE_DEBUG_ERROR, "purple_mkstemp",
"g_get_tmp_dir() failed!\n");
}
return fp;
}
<-- end code -->
I'll wait for some position of you about that, because is much better for
me to maintain as much libpurple code unchanged as possible.
Thank's again, and best regards!
--
Ticket URL: <http://developer.pidgin.im/ticket/1359#comment:2>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list