summary refs log tree commit diff
path: root/pkgs/applications/networking/p2p/gnunet/tmpdir.patch
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-08-24 18:48:09 +0000
committerLudovic Courtès <ludo@gnu.org>2008-08-24 18:48:09 +0000
commiteddce10d13f29eb55bbce4910a21683e5bc7e3ea (patch)
treed8bdc4eed21058f4be53db0c422578fdcf02626a /pkgs/applications/networking/p2p/gnunet/tmpdir.patch
parenta5deaa8e0779c2043f87b5885a7c48437346e1ea (diff)
downloadnixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.gz
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.bz2
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.lz
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.xz
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.tar.zst
nixlib-eddce10d13f29eb55bbce4910a21683e5bc7e3ea.zip
Add GNUnet, GNU's anonymous peer-to-peer communication framework.
svn path=/nixpkgs/trunk/; revision=12699
Diffstat (limited to 'pkgs/applications/networking/p2p/gnunet/tmpdir.patch')
-rw-r--r--pkgs/applications/networking/p2p/gnunet/tmpdir.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/pkgs/applications/networking/p2p/gnunet/tmpdir.patch b/pkgs/applications/networking/p2p/gnunet/tmpdir.patch
new file mode 100644
index 000000000000..e47a253e0f0f
--- /dev/null
+++ b/pkgs/applications/networking/p2p/gnunet/tmpdir.patch
@@ -0,0 +1,93 @@
+Make sure the core libraries used by the tests honor $TMPDIR.
+
+diff --git a/src/applications/dstore_sqlite/dstore.c b/src/applications/dstore_sqlite/dstore.c
+index cdcae81..4bb45a3 100644
+--- a/src/applications/dstore_sqlite/dstore.c
++++ b/src/applications/dstore_sqlite/dstore.c
+@@ -129,6 +129,7 @@ db_reset ()
+   int fd;
+   sqlite3 *dbh;
+   char *tmpl;
++  const char *tmpdir;
+ 
+   if (fn != NULL)
+     {
+@@ -136,7 +137,15 @@ db_reset ()
+       GNUNET_free (fn);
+     }
+   payload = 0;
+-  tmpl = "/tmp/dstoreXXXXXX";
++
++  tmpdir = getenv ("TMPDIR");
++  tmpdir = tmpdir ? tmpdir : "/tmp";
++
++#define TEMPLATE "/gnunet-dstoreXXXXXX"
++  tmpl = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tmpl, tmpdir);
++  strcat (tmpl, TEMPLATE);
++#undef TEMPLATE
+ 
+ #ifdef MINGW
+   fn = (char *) GNUNET_malloc (MAX_PATH + 1);
+diff --git a/src/applications/fs/collection/collection.c b/src/applications/fs/collection/collection.c
+index 5671cb3..da2b605 100644
+--- a/src/applications/fs/collection/collection.c
++++ b/src/applications/fs/collection/collection.c
+@@ -487,6 +487,7 @@ GNUNET_CO_collection_publish_now ()
+   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,17 @@ GNUNET_CO_collection_publish_now ()
+       GNUNET_mutex_unlock (lock);
+       return;
+     }
+-  tmpName = GNUNET_strdup ("/tmp/gnunet-collectionXXXXXX");
++
++  tmpdir = getenv ("TMPDIR");
++  tmpdir = tmpdir ? tmpdir : "/tmp";
++
++#define TEMPLATE "/gnunet-collectionXXXXXX"
++  tmpName = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tmpName, tmpdir);
++  strcat (tmpName, TEMPLATE);
++#undef TEMPLATE
++
++  tmpName = GNUNET_strdup (tmpName);
+   fd = mkstemp (tmpName);
+   if (fd == -1)
+     {
+diff --git a/src/applications/fs/fsui/upload.c b/src/applications/fs/fsui/upload.c
+index dc683a5..46a04af 100644
+--- a/src/applications/fs/fsui/upload.c
++++ b/src/applications/fs/fsui/upload.c
+@@ -159,6 +159,7 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx,
+   int handle;
+   struct GNUNET_GE_Memory *mem;
+   struct GNUNET_GE_Context *ee;
++  const char *tmpdir;
+ 
+   fis = NULL;
+   size = 0;
+@@ -208,7 +209,17 @@ createDirectoryHelper (struct GNUNET_GE_Context *ectx,
+       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 = alloca (strlen (tmpdir) + sizeof (TEMPLATE) + 1);
++  strcpy (tempName, tmpdir);
++  strcat (tempName, TEMPLATE);
++#undef TEMPLATE
++
++  tempName = GNUNET_strdup (tempName);
+   handle = mkstemp (tempName);
+   if (handle == -1)
+     {