commit d1f3028d75e82fa6a26a30a059b11f42e360b614
parent abc7c3ae982caf2d114c8a7daf56fdff042aef99
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 8 Mar 2010 10:49:04 +0000
fixing IPC for FreeBSD
Diffstat:
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main/extractor.c b/src/main/extractor.c
@@ -1486,14 +1486,22 @@ make_shm (int is_tail,
size_t fn_size,
size_t size)
{
- snprintf (fn,
- fn_size,
+ const char *tpath;
+
#ifdef WINDOWS
- "%TEMP%\\"
+ tpath = "%TEMP%\\";
+#elif SOMEBSD
+ /* this works on FreeBSD, not sure about others... */
+ tpath = getenv ("TMPDIR");
+ if (tpath == NULL)
+ tpath = "/tmp/";
#else
- "/"
-#endif
- "libextractor-%sshm-%u-%u",
+ tpath = "/"; /* Linux */
+#endif
+ snprintf (fn,
+ fn_size,
+ "%slibextractor-%sshm-%u-%u",
+ tpath,
(is_tail) ? "t" : "",
getpid(),
(unsigned int) RANDOM());