#! /bin/sh /usr/share/dpatch/dpatch-run
## 11_hurd_no_path_max_bsdsource.dpatch by Samuel Thibault
## <samuel.thibault@ens-lyon.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Hurd has no such hard limit like PATH_MAX, and define _BSD_SOURCE
## DP: because code uses IXANY and O_NDELAY.

@DPATCH@
diff -urNad libgphoto2-2.4.0~/camlibs/digita/digita.c libgphoto2-2.4.0/camlibs/digita/digita.c
--- libgphoto2-2.4.0~/camlibs/digita/digita.c	2007-07-27 02:35:51.000000000 +0200
+++ libgphoto2-2.4.0/camlibs/digita/digita.c	2007-08-15 00:08:35.993573985 +0200
@@ -138,7 +138,6 @@
 	/* Walk through all of the pictures building a list of folders */
 	for (i = 0; i < camera->pl->num_pictures; i++) {
 		int found;
-		char tmppath[PATH_MAX + 1];
 		char *path;
 
 		/* Check to make sure the path matches the folder we're */
@@ -159,22 +158,19 @@
 		if (strchr(path, '/') != path + strlen(path) - 1)
 			continue;
 
-		strncpy(tmppath, path, MIN(strlen(path) - 1, PATH_MAX));
-		tmppath[strlen(path) - 1] = 0;
-
 		found = 0;
 		for (i1 = 0; i1 < gp_list_count(list); i1++) {
 			const char *name;
 
 			gp_list_get_name(list, i1, &name);
-			if (!strcmp(name, tmppath)) {
+			if (!strcmp(name, path)) {
 				found = 1;
 				break;
 			}
 		}
 
 		if (!found)
-			gp_list_append(list, tmppath, NULL);
+			gp_list_append(list, path, NULL);
 	}
 
 	return GP_OK;
diff -urNad libgphoto2-2.4.0~/libgphoto2_port/serial/unix.c libgphoto2-2.4.0/libgphoto2_port/serial/unix.c
--- libgphoto2-2.4.0~/libgphoto2_port/serial/unix.c	2007-07-27 02:36:13.000000000 +0200
+++ libgphoto2-2.4.0/libgphoto2_port/serial/unix.c	2007-08-15 00:08:58.494856260 +0200
@@ -27,6 +27,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#define _BSD_SOURCE
 #include "config.h"
 #include <gphoto2/gphoto2-port-library.h>
 
