Mercurial > pidgin
changeset 3233:96e215745dc0
[gaim-migrate @ 3250]
Changed gaim_mkstemp() to use GLib's g_get_tmp_dir() at Sean's suggestion.
committer: Tailor Script <tailor@pidgin.im>
author | Jim Seymour <jseymour> |
---|---|
date | Wed, 08 May 2002 00:21:26 +0000 |
parents | cf460a8c859c |
children | 6a96436a542a |
files | src/util.c |
diffstat | 1 files changed, 4 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util.c Tue May 07 23:41:30 2002 +0000 +++ b/src/util.c Wed May 08 00:21:26 2002 +0000 @@ -1281,20 +1281,11 @@ FILE *gaim_mkstemp(gchar **fpath) { - static char *tmpdir = NULL; + gchar *tmpdir; int fd; FILE *fp = NULL; - if(!tmpdir) { - if((tmpdir = tempnam(NULL, NULL)) == NULL) { - debug_printf("Error: tempnam() failed, error: %d\n", errno); - } else { - char *t = strrchr(tmpdir, '/'); - *t = '\0'; - } - } - - if(tmpdir) { + if((tmpdir = g_get_tmp_dir()) != NULL) { if((*fpath = g_strdup_printf("%s/%s", tmpdir, gaim_mkstemp_templ)) != NULL) { if((fd = mkstemp(*fpath)) == -1) { debug_printf("Error: Couldn't make \"%s\", error: %d\n", *fpath, errno); @@ -1309,6 +1300,8 @@ *fpath = NULL; } } + } else { + debug_printf("Error: g_get_tmp_dir() failed in gaim_mkstemp()!\n"); } return fp;