Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
diff --git a/src/itdb_sqlite.c b/src/itdb_sqlite.c
index 56c2506..4b92370 100644
--- a/src/itdb_sqlite.c
+++ b/src/itdb_sqlite.c
@@ -2256,6 +2256,7 @@ int itdb_sqlite_generate_itdbs(FExport *fexp)
gchar *itlpdir;
gchar *dirname;
gchar *tmpdir = NULL;
+ gchar dirtmp[16];
printf("libitdbprep: %s called with file %s and uuid %s\n", __func__,
fexp->itdb->filename, itdb_device_get_uuid(fexp->itdb->device));
@@ -2278,7 +2279,9 @@ int itdb_sqlite_generate_itdbs(FExport *fexp)
tzoffset = fexp->itdb->tzoffset;
- tmpdir = g_build_path(g_get_tmp_dir(), tmpnam(NULL), NULL);
+ strcpy(dirtmp, "libgpod.XXXXXX");
+ g_mkstemp(dirtmp);
+ tmpdir = g_build_path(G_DIR_SEPARATOR_S, g_get_tmp_dir(), dirtmp, NULL);
if (g_mkdir(tmpdir, 0755) != 0) {
g_set_error (&fexp->error, G_FILE_ERROR, g_file_error_from_errno(errno),
"Could not create temporary directory '%s': %s",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment