aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/plugin_datacache_sqlite.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2009-07-27 20:07:24 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2009-07-27 20:07:24 +0000
commitc6aef09cb802e788a21efd604b027c7189ddc0b2 (patch)
tree81738f3a8a167533ddf001a72809dfa5015186de /src/datacache/plugin_datacache_sqlite.c
parent42e45eb737e595bb725366ac6e1e9e61052cf9cc (diff)
mktemp
git-svn-id: https://gnunet.org/svn/gnunet@8804 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datacache/plugin_datacache_sqlite.c')
-rw-r--r--src/datacache/plugin_datacache_sqlite.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 5493dbb905..63f8cbd674 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -346,35 +346,15 @@ libgnunet_plugin_datacache_sqlite_init (void *cls)
struct Plugin *plugin;
char *fn;
char *fn_utf8;
- int fd;
sqlite3 *dbh;
- char *tmpl;
- const char *tmpdir;
char *emsg;
- tmpdir = getenv ("TMPDIR");
- tmpdir = tmpdir ? tmpdir : "/tmp";
-
-#define TEMPLATE "/gnunet-dstoreXXXXXX"
- tmpl = GNUNET_malloc (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
- strcpy (tmpl, tmpdir);
- strcat (tmpl, TEMPLATE);
-#undef TEMPLATE
-#ifdef MINGW
- fn = (char *) GNUNET_malloc (MAX_PATH + 1);
- plibc_conv_to_win_path (tmpl, fn);
- GNUNET_free (tmpl);
-#else
- fn = tmpl;
-#endif
- fd = mkstemp (fn);
- if (fd == -1)
+ fn = GNUNET_DISK_mktemp ("gnunet-datacache");
+ if (fn == NULL)
{
GNUNET_break (0);
- GNUNET_free (fn);
return NULL;
}
- CLOSE (fd);
fn_utf8 = GNUNET_STRINGS_to_utf8 (fn, strlen (fn),
#ifdef ENABLE_NLS
nl_langinfo (CODESET)