summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2002-07-09 18:52:32 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2002-07-09 18:52:32 +0000
commit4932b87fc9102cd15f70eccc8d6df3b8fcdfe196 (patch)
tree055ecae3621c9f97ce44ff6c69eb9220e5381200 /src
parent01d2966cb8dfd577943d63455a0be45a95db20f7 (diff)
downloadtinyproxy-4932b87fc9102cd15f70eccc8d6df3b8fcdfe196.tar.gz
tinyproxy-4932b87fc9102cd15f70eccc8d6df3b8fcdfe196.zip
(malloc_shared_memory): Changed the static character array to include the ".XXXXXX" string already. This saves one system call when creating a temporary file name.
Diffstat (limited to 'src')
-rw-r--r--src/heap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/heap.c b/src/heap.c
index 3a425f7..428c853 100644
--- a/src/heap.c
+++ b/src/heap.c
@@ -1,4 +1,4 @@
-/* $Id: heap.c,v 1.4 2002-06-05 17:01:09 rjkaes Exp $
+/* $Id: heap.c,v 1.5 2002-07-09 18:52:32 rjkaes Exp $
*
* Debugging versions of various heap related functions are combined
* here. The debugging versions include assertions and also print
@@ -105,14 +105,13 @@ malloc_shared_memory(size_t size)
{
int fd;
void* ptr;
- char buffer[128];
+ char buffer[32];
- static char* shared_file = "/tmp/tinyproxy.shared";
+ static char* shared_file = "/tmp/tinyproxy.shared.XXXXXX";
assert(size > 0);
- strlcpy(buffer, shared_file, sizeof(buffer) - 8);
- strlcat(buffer, ".XXXXXX", sizeof(buffer));
+ strlcpy(buffer, shared_file, sizeof(buffer));
if ((fd = mkstemp(buffer)) == -1)
return (void *)MAP_FAILED;