Package: perforate Severity: important Tags: patch Hello,
Perforate package doesn't build on Debian GNU/Hurd because of the MAXPATHLEN macro which doesn't exist on Debian GNU/Hurd. Please take a look at the buildd log [0]for further informations. Regards, Arnaud Fontaine [0] http://www.buildd.net/cgi/package_status?unstable_pkg=perforate&searchtype=hurd-i386&arch=hurd-i386 -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: hurd-i386 (i686-AT386) Shell: /bin/sh linked to /bin/bash Kernel: GNU 0.3
diff -urN perforate-1.2.old/zum.c perforate-1.2/zum.c
--- perforate-1.2.old/zum.c 2006-03-09 12:25:35.000000000 +0100
+++ perforate-1.2/zum.c 2006-03-09 13:53:13.000000000 +0100
@@ -13,6 +13,7 @@
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
+#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
@@ -26,9 +27,45 @@
#include <utime.h>
#include <alloca.h>
#include <unistd.h>
+#include <stdlib.h>
extern int errno;
+/* GLibc provides getline, which allocate automatically the right
+ amount for the line, read by *stream. If not available, use
+ ours. */
+#ifdef __GLIBC__
+# define my_getline getline
+#else
+# define GETLINE_CHUNK_SIZE 4096
+
+static ssize_t my_getline(char **lineptr, size_t *n, FILE *stream)
+{
+ if(lineptr == NULL || n == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if(*n == 0)
+ {
+ *lineptr = malloc(sizeof (char *) * GETLINE_CHUNK_SIZE);
+ *n = GETLINE_CHUNK_SIZE;
+ }
+
+ char *ret = fgets (*lineptr, *n, stream);
+ while(ret != NULL && (*lineptr)[strlen (*lineptr) - 1] != '\n')
+ {
+ *n += GETLINE_CHUNK_SIZE;
+ *lineptr = realloc(*lineptr, sizeof (char *) * *n);
+
+ ret = fgets(*lineptr + strlen (*lineptr), GETLINE_CHUNK_SIZE, stream);
+ }
+
+ return (ret ? strlen (*lineptr) : -1);
+}
+#endif /* !__GLIBC__ */
+
static char suffix[] = "__zum__";
static void* my_mmap(void *ptr, int fd, off_t size, off_t *pos)
@@ -181,9 +218,13 @@
while((p = *(++argv)))
zero_unmap(p);
else {
- char buf[MAXPATHLEN];
- while(fgets(buf, MAXPATHLEN, stdin))
+ char *buf = NULL;
+ size_t len = 0;
+ while(my_getline(&buf, &len, stdin) != -1)
zero_unmap(buf);
+
+ if (buf)
+ free(buf);
}
return 0;
}
pgpBFPYWICvCq.pgp
Description: PGP signature

