[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7623 - in GNUnet/src/applications: dstore_sqlite fs/collec
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7623 - in GNUnet/src/applications: dstore_sqlite fs/collection fs/fsui |
Date: |
Mon, 25 Aug 2008 15:02:02 -0600 (MDT) |
Author: grothoff
Date: 2008-08-25 15:02:02 -0600 (Mon, 25 Aug 2008)
New Revision: 7623
Modified:
GNUnet/src/applications/dstore_sqlite/dstore.c
GNUnet/src/applications/fs/collection/collection.c
GNUnet/src/applications/fs/fsui/upload.c
Log:
support TMPDIR
Modified: GNUnet/src/applications/dstore_sqlite/dstore.c
===================================================================
--- GNUnet/src/applications/dstore_sqlite/dstore.c 2008-08-25 13:30:01 UTC
(rev 7622)
+++ GNUnet/src/applications/dstore_sqlite/dstore.c 2008-08-25 21:02:02 UTC
(rev 7623)
@@ -129,6 +129,7 @@
int fd;
sqlite3 *dbh;
char *tmpl;
+ const char *tmpdir;
if (fn != NULL)
{
@@ -136,13 +137,22 @@
GNUNET_free (fn);
}
payload = 0;
- tmpl = "/tmp/dstoreXXXXXX";
+ 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 = GNUNET_strdup (tmpl);
+ fn = tmpl;
#endif
fd = mkstemp (fn);
if (fd == -1)
Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c 2008-08-25 13:30:01 UTC
(rev 7622)
+++ GNUnet/src/applications/fs/collection/collection.c 2008-08-25 21:02:02 UTC
(rev 7623)
@@ -487,6 +487,7 @@
char *dirData;
char this_revision_string[128];
char next_revision_string[128];
+ const char *tmpdir;
GNUNET_mutex_lock (lock);
if ((collectionData == NULL) ||
@@ -495,7 +496,15 @@
GNUNET_mutex_unlock (lock);
return;
}
- tmpName = GNUNET_strdup ("/tmp/gnunet-collectionXXXXXX");
+
+ tmpdir = getenv ("TMPDIR");
+ tmpdir = tmpdir ? tmpdir : "/tmp";
+
+#define TEMPLATE "/gnunet-collectionXXXXXX"
+ tmpName = GNUNET_malloc (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
+ strcpy (tmpName, tmpdir);
+ strcat (tmpName, TEMPLATE);
+#undef TEMPLATE
fd = mkstemp (tmpName);
if (fd == -1)
{
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2008-08-25 13:30:01 UTC (rev
7622)
+++ GNUnet/src/applications/fs/fsui/upload.c 2008-08-25 21:02:02 UTC (rev
7623)
@@ -159,6 +159,7 @@
int handle;
struct GNUNET_GE_Memory *mem;
struct GNUNET_GE_Context *ee;
+ const char *tmpdir;
fis = NULL;
size = 0;
@@ -208,7 +209,15 @@
pos = pos->next;
}
GNUNET_GE_memory_reset (mem);
- tempName = GNUNET_strdup ("/tmp/gnunet-upload-dir.XXXXXX");
+
+ tmpdir = getenv ("TMPDIR");
+ tmpdir = tmpdir ? tmpdir : "/tmp";
+
+#define TEMPLATE "/gnunet-upload-dirXXXXXX"
+ tempName = GNUNET_malloc (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
+ strcpy (tempName, tmpdir);
+ strcat (tempName, TEMPLATE);
+#undef TEMPLATE
handle = mkstemp (tempName);
if (handle == -1)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7623 - in GNUnet/src/applications: dstore_sqlite fs/collection fs/fsui,
gnunet <=