Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 4, 2014 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/9345867 to your computer and use it in GitHub Desktop.
Save mattn/9345867 to your computer and use it in GitHub Desktop.
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