summaryrefslogtreecommitdiff
path: root/multimedia/vdr/files/patch-tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/vdr/files/patch-tools.c')
-rw-r--r--multimedia/vdr/files/patch-tools.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/multimedia/vdr/files/patch-tools.c b/multimedia/vdr/files/patch-tools.c
new file mode 100644
index 000000000000..d99421e11781
--- /dev/null
+++ b/multimedia/vdr/files/patch-tools.c
@@ -0,0 +1,38 @@
+--- tools.c.orig
++++ tools.c
+@@ -1201,9 +1201,35 @@ cReadLine::~cReadLine()
+ free(buffer);
+ }
+
++#ifdef __FreeBSD__
++#if __FreeBSD_version > 800000
++#define HAVE_GETLINE
++#endif
++#else
++#define HAVE_GETLINE
++#endif
++
+ char *cReadLine::Read(FILE *f)
+ {
++#ifndef HAVE_GETLINE
++ size_t n;
++
++ if (!buffer) {
++ if (!(buffer = (char *)malloc(size = 4096)))
++ return NULL;
++ }
++ if (!fgets(buffer, size, f))
++ return NULL;
++ while ((n = strlen(buffer)) >= size - 1 && buffer[n - 1] != '\n') {
++ if (!(buffer = (char *)realloc(buffer, size * 2)))
++ return NULL;
++ size *= 2;
++ if (!fgets(buffer + n, size - n, f))
++ break;
++ }
++#else
+ int n = getline(&buffer, &size, f);
++#endif
+ if (n > 0) {
+ n--;
+ if (buffer[n] == '\n') {