$NetBSD: patch-ac,v 1.2 2005/11/04 22:30:34 dbj Exp $

--- modules/file-method.c.orig	2002-03-14 22:33:01.000000000 -0500
+++ modules/file-method.c
@@ -35,9 +35,12 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/param.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <utime.h>
@@ -767,9 +770,15 @@ read_directory (DirectoryHandle *handle,
 		filter_needs = GNOME_VFS_DIRECTORY_FILTER_NEEDS_NOTHING;
 	}
 
+#if (defined(BSD) && BSD >= 199306)
+	if ((result = readdir (handle->dir)) != NULL) {
+		*handle->current_entry = *result;
+	}
+#else
 	if (readdir_r (handle->dir, handle->current_entry, &result) != 0) {
 		return gnome_vfs_result_from_errno ();
 	}
+#endif
 	
 	if (result == NULL) {
 		return GNOME_VFS_ERROR_EOF;
@@ -1099,9 +1108,15 @@ find_trash_in_one_hierarchy_level (const
 
 	item_buffer = g_malloc (sizeof (struct dirent) + GET_PATH_MAX() + 1);
 	for (;;) {
+#if (defined(BSD) && BSD >= 199306)
+		if ((item = readdir (directory)) != NULL) {
+			*item_buffer = *item;
+		}
+#else
 		if (readdir_r (directory, item_buffer, &item) != 0 || item == NULL) {
 			break;
 		}
+#endif
 
 		if (gnome_vfs_context_check_cancellation (context))
 			break;
