$NetBSD: patch-ab,v 1.1.1.1 2009/01/17 20:43:27 wiz Exp $
--- hacklocaledir.c.orig	2003-07-08 10:23:53.000000000 -0400
+++ hacklocaledir.c
@@ -40,12 +40,21 @@ int __open(char const *path, int flags, 
     static size_t matchlen;
     char *newpath = 0;
     int r;
-
+#ifdef RTLD_NEXT
     if (!open && !(open = dlsym(RTLD_NEXT, "open")))
     {
 	fprintf(stderr, PRELOAD ": can't find open(): %s\n", dlerror());
 	return -1;
     }
+#else
+    void *handle = dlopen(NULL, DL_LAZY);
+    if (!open && !(open = dlsym(handle, "open")))
+    {
+        fprintf(stderr, PRELOAD ": can't find open(): %s\n", dlerror());
+        return -1;
+    }
+    dlclose(handle);
+#endif
 
     if (textdomain || (textdomain = getenv("TEXTDOMAIN")))
     {
