pkgsrc/sysutils/fam/patches/patch-aj
jmmv 0024f4a6f3 Fix location of temporary files, as they were beeing created under / instead
of /tmp!  If you have been using GNOME, you may want to 'rm -f /.fam*' to
clean them up.

The problem is caused by two different issues, related to a call to tempnam:

- The code uses a HAVE_UNSETENV define to check if the unsetenv function
  is available; however, the configure script does not check for it, so
  unsetenv is never used.  Fix the configure script to check for unsetenv.

- If unsetenv is not available, it does putenv("TMPDIR=") before calling
  tempnam.  The code expects that this call *unsets* the variable from the
  environment (which happens in Linux), but instead it is *set* to an empty
  value, causing the creation of files in the root directory.  Fix this by
  explicitly setting TMPDIR to /tmp.

Bump PKGREVISION to 1.
2004-04-18 17:11:08 +00:00

53 lines
1.4 KiB
Text

$NetBSD: patch-aj,v 1.6 2004/04/18 17:11:08 jmmv Exp $
--- src/Listener.c++.orig 2003-01-20 01:37:29.000000000 +0100
+++ src/Listener.c++
@@ -22,6 +22,8 @@
#include "Listener.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <assert.h>
#include <fcntl.h>
#include <sys/types.h>
@@ -32,6 +34,7 @@
#include <rpc/clnt.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/param.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
@@ -205,11 +208,11 @@ Listener::create_local_client(TCP_Client
#ifdef HAVE_UNSETENV
unsetenv("TMPDIR");
#else
- putenv("TMPDIR=");
+ putenv("TMPDIR=/tmp");
#endif
char *tmpfile = tempnam("/tmp", ".fam");
-#ifdef HAVE_SOCKADDR_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
#else
sockaddr_un sun = { AF_UNIX, "" };
@@ -283,7 +286,7 @@ Listener::accept_localclient(int ofd, vo
// Get the new socket.
-#ifdef HAVE_SOCKADDR_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
struct sockaddr_un sun = { sizeof(sockaddr_un), AF_UNIX, "" };
#else
struct sockaddr_un sun = { AF_UNIX, "" };
@@ -349,7 +352,7 @@ Listener::accept_localclient(int ofd, vo
void
Listener::dirty_ugly_hack()
{
-#ifdef HAVE_SOCKADDR_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
static sockaddr_un sun = { sizeof (sockaddr_un), AF_UNIX, "/tmp/.fam_socket" };
#else
static sockaddr_un sun = { AF_UNIX, "/tmp/.fam_socket" };